checkbox函数返回相同的开关结果 [英] checkbox function returning same result for on and off

查看:82
本文介绍了checkbox函数返回相同的开关结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




这是我的程序,它正在重新打印相同的消息已检查每次,无论是我的选择还是取消选中给定的复选框。


请看看。


< html>

< head>

< title>客户咨询< / title>

< SCRIPT language =" JavaScript1.2">

函数txtReasonState(name)

{

if(document.sysaccess.name.checked == false)

{

alert(" uncheked");

}

else

{

alert (已检查);

}


}

< / SCRIPT>

< / head>

< body>


< form name =" sysaccess" >

< input type ="复选框"名称= QUOT; checkbox1" onClick =" txtReasonState(this.name)">


< / form>


< / body>

< / html>


thax

Manoj



This is my program and it is resluting same message "checked" everytime, either i checed it or unchecked the given checkbox.

Please have a look .

<html>
<head>
<title>Customer Inquiry</title>
<SCRIPT language="JavaScript1.2">
function txtReasonState(name)
{
if (document.sysaccess.name.checked==false)
{
alert("uncheked");
}
else
{
alert("checked");
}

}
</SCRIPT>
</head>
<body>

<form name="sysaccess" >
<input type="checkbox" name="checkbox1" onClick="txtReasonState(this.name)">

</form>

</body>
</html>

thax
Manoj

推荐答案


hi,


这是我的程序,它正在重新打印相同的消息已检查每次,无论是我的选择还是取消选中给定的复选框。


请看看。


< html>

< head>

< title>客户咨询< / title>

< SCRIPT language =" JavaScript1.2">

函数txtReasonState(name)

{

if(document.sysaccess.name.checked == false)

{

alert(" uncheked");

}

else

{

alert (已检查);

}


}

< / SCRIPT>

< / head>

< body>


< form name =" sysaccess" >

< input type ="复选框"名称= QUOT; checkbox1" onClick =" txtReasonState(this.name)">


< / form>


< / body>

< / html>


thax

Manoj


This is my program and it is resluting same message "checked" everytime, either i checed it or unchecked the given checkbox.

Please have a look .

<html>
<head>
<title>Customer Inquiry</title>
<SCRIPT language="JavaScript1.2">
function txtReasonState(name)
{
if (document.sysaccess.name.checked==false)
{
alert("uncheked");
}
else
{
alert("checked");
}

}
</SCRIPT>
</head>
<body>

<form name="sysaccess" >
<input type="checkbox" name="checkbox1" onClick="txtReasonState(this.name)">

</form>

</body>
</html>

thax
Manoj



更改在两个地方。


Change at two places.

展开 | 选择 | Wrap | 行号


hi ...


是的......这将是一个解决方案。另一种方法是将条件的表达式更改为:

hi ...

yep ... that would be one solution. An other would be to change the expression for the condition to:

展开 | 选择 | Wrap | 行号


hi,


thanx dmjpro工作正常,但是gits也尝试了你的解决方案而且它无法正常工作。


再次感谢你们双方的回复


thanx dmjpro it is working fine, but gits also tried your solution and it is not working.

thanx again both of you for reply


这篇关于checkbox函数返回相同的开关结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆