var xx = document.getElementById('xx').value;
alert(xx);------->>>输出10
现在需要
function f(){
if(?????????????){//需要根据xx的值来判定是否alert,例如xx>10
alert("ok!");
}
}
???????该如何写
你不是写了吗,xx>10
xx=new Number(xx);
if(xx==xx&&xx&&xx>10){
alert("xx>10");
}
function f(){
if(parseInt(document.getElementById('xx').value)>10)
alert("ok!");
}
}
你可以直接在表签中写任意的js语法如:
var xx = document.getElementById('xx').value; if(xx>10){ alert("ok!"); }将你的f()改成:
function f(value){
if(value >10)
alert("ok!");
}
};
f(xx);