에 사용되는 일부 공상 JQuery와 선택기는 그것을 할 것입니다 :
http://jsfiddle.net/qPPsH/1/
findThings = function(){
// select the first <b> elements that contain "Clicks", AND
// has a sibling before it that is a <font>, AND
// has a sibling THAT has both an <h2> as a parent, and contains the text "Progress".
var firstnumber = -1; // some number that doesn't make sense
var secondnumber = -1;
$('h2 > b:contains("Progress:") + font + b:contains("Clicks"):first').each(
function(){
//alert("Element is:",this);
//alert("Element contains:" + $(this).text());
// "this" is the <b> that contains "Clicks". Find the first sibling that is a <font> and grab the text from it.
text = $(this).siblings("font:first").text();
//alert(text);
numbers = text.split("/"); //split the text by "/" character.
if (numbers.length == 2){ // make sure there are two numbers!
firstnumber = numbers[0];
secondnumber = numbers[1];
}
}
);
alert("First number:" + firstnumber);
alert("Second number:" + secondnumber);
var whatever = 5;
if(firstnumber >= whatever){
alert("YOU WIN!");
}else{
alert("You Lose!");
}
}
하지만이 단지 작품을 코드에 배치되어있는 경우 같은 사이트. 같은 사이트에 있다면 멍청한 아이디어입니다. 어쨌든 요소에 ID를 붙이고 ID로 값에 액세스 할 수 있기 때문입니다. 그래도 멋진 셀렉터가 될 수있는 방법을 보여줍니다.
무엇을 시도 했습니까? JS는 정말 쉽게 시작할 수 있습니다. – TheZ
나는 자바 스크립트와 함께 말할 것입니다. 자바 스크립트에 대한 책을 읽으려고 한 적이 있습니까? – hakre
post/get은 해당 번호가 '