解决方案 »
- jquery1.4.4下引入jquery1.4.2写的方法 报错!!
- 获取select值
- 趁大家还没放假,赶紧问个问题,大哥快来帮帮小弟
- 请高手把这四行代码翻译成jQuery语句,学习中...
- 求一个作验证的JS
- 如何判断用户离开本页,转到了别的页面或者关闭本页了(难度大)
- JQuery UI里面怎么在模态窗体里面设置最大化和最小化按钮,以及设置层的透明度
- 按纽的onclick函数 搞不定,求救!
- 为什么在ShowModalDialog中设置status为no,但对话框还是有状态栏??
- 在父窗口用window.open()方法,打开新页面后,父窗口能不能自动关闭,并且不用提示?
- 请问如何阻止js事件触发
- 谢谢~~ 帮我毕业~~~
alert("yes too too too!");
}
这一行判断应该执行的,却没有执行,因为clientip4<=ipn[3]返回false,这两个变量是我前面已经赋值了的
var a="35",b="255";
alert(a<b);
alert((a-0)<(b-0));//-0转化 为int
或者加上parseInt()
if(parseInt(clientip3)<=parseInt(ipn[2])){
alert("yes too too");
alert("clientip4:"+clientip4+" ipn[3]:"+ipn[3]);
alert(clientip4<=ipn[3]);
if(clientip4<=ipn[3]){
alert("yes too too too!");
}
}
被你注释掉了
改为clientip4=35;
ipn[3]=255;
试下
var test=function(){
var clientip1=35;var ipn=new Array();
ipn[0]=50;
ipn[1]=100;
ipn[2]=200;
ipn[3]=255;
if(clientip1<=parseInt(ipn[0])){
alert("yes")
if(clientip1<=parseInt(ipn[1])){
alert("yes too");
if(clientip1<=parseInt(ipn[2])){
alert("yes too too");
alert("clientip4:"+clientip1+" ipn[3]:"+parseInt(ipn[3]));
//clientip4=35,ipn[3]=255,但是下面的对话框弹出的竟然是false,if判断也没执行。
alert(clientip1<=parseInt(ipn[3]));
if(clientip1<=parseInt(ipn[3])){
alert("yes too too too!");
}
}
}
}
}();</script>
这一行是我写给你们看的,不是程序里面的代码,是我的错,写在这个位置你们都以为是代码
问题已经解决,我的疑问是为什么我其他的判断也是这样写:if(clientip1<=ipn[0])。
为什么就只有这一个判断有问题呢,想不通。
而且你说的"其他地方判断时没问题" 可能也有问题,因为clientip1 和ipn[0]假如用的的是字符,也是可以判断
例如:
<script>
function b(){
var a = "A";
var b = "3";
if(a>b){
alert("true");
}
}
</script>
<input type = "button" value = "dddd" onclick= "b();"/>
</script>
结果是“true”