What I am trying to do is make a single radiobutton works link a checkbox, click on, click off. But after many test, it looks like I have to have a line of code, such as alert(), in order to make it happen, any idea why? ( I don’t want alert() pupops up ). Thanks in advance~!
<script type="text/javascript">
function on_off(id)
{
if(document.getElementById(id).checked == false)
{
alert("Select VIP"); // function works with this line
document.getElementById(id).checked = true;
}
else if(document.getElementById(id).checked == true)
{
alert("unSelect VIP"); // function works with this line
document.getElementById(id).checked = false;
}
}
</script>
<input name="x_checker" id="x_checker" value="yes" checked="checked" onfocus="on_off('x_checker')" type="radio">