我想提示,然后比较两个值:JavaScript的比较失败
var x,y;
x = prompt("enter the first value","");
x = prompt("enter the second value","");
if(x > y)
{
alert("x>y");
}
else if(x < y)
{
alert("y>x")
}
else
{
alert("error");
}
每次我跑这一点,alert("error")
线被击中。我究竟做错了什么?
你正在使用`x =`两次 – vol7ron 2011-02-10 00:59:22