The following example shows that the result is no overload display submission.
when the user selects an option, a function is called "getvote ()" execution. The "onclick" event that is raised by this feature
Copy Code code as follows:
<script type= "Text/javascript" >
function getvote (int)
{
if (window). XMLHttpRequest)
{//code for ie7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest ();
}
Else
{//code for IE6, IE5
xmlhttp=new activexobject ("Microsoft.XMLHTTP");
}
Xmlhttp.onreadystatechange=function ()
{
if (xmlhttp.readystate==4 && xmlhttp.status==200)
{
document.getElementById ("poll"). Innerhtml=xmlhttp.responsetext;
}
}
Xmlhttp.open ("Get", "poll_vote.php?vote=" +int,true);
Xmlhttp.send ();
}
</script>
<body>
<div id= "poll" >
<form>
Yes:
<input type= "Radio" name= "vote" value= "0" onc lick= "Getvote (this.value)"/>
<br/>no:
<input TypE= "Radio" name= "Vote" value= "1" onclick= "Getvote (this.value)"/>
</form>
</div>
</body& Gt
the Getvote () function does the following:
Create an XMLHttpRequest object
Create the function to being executed the server response is ready
Send the request off to a file on the server
Notice that a parameter (vote) are added to the URL (with the value of the Yes or no option)
to determine if the control's disabled property is true, return false, implement the disable Radio onclick event, and enable it again
method One: (At the same time disable, re-enable features, only for button text type input, the DIV can not disable its OnClick event)
<input type= "button" value= "A button. Click me to the Alert box. "onclick=" alert (' I am clicked. '); "id= cmd1"/>
<br/>
<input type= "button" value= "Click Me to disable" "Onclick=" document.getElementById (' cmd1 '). disabled=true; "/>
<br/>
method Two, three: (Implement the Remove Radio onclick event, need to re-register the event again, you can disable Div's onclick event)
<input type= "button" value= "Click me to disable the onclick event on the" "Onclick=" document.getElementById (' cm D1 '). Onclick=function () {}; "/>
<br/>
III:
<input type= "button" value= "Click me to disable the onclick event on the" "Onclick=" document.getelementbyi D (' cmd1 '). Onclick=null; "/>