G
GarryJones
This is driving me simply crazy ... this simple (?) code works in Msie
but not Firefox.
function checkform ()
{
if (document.regfrms.cgbx.itm1.checked == false &&
document.regfrms.cgbx.itm2.checked == false){
alert( "You have to choose one" );
document.regfrms.cgbx.itm1.focus();
return false ;
}
return true ;
}
It checks the values of 2 radio buttons and if neither have been
pressed it alerts the user.
See this for yourselves....
http://www.morack.se/firedfox.html
So the question (before I request the British Government to make FOX
hunting compulsory) is how does firefox handle the checked status of
radio buttons..... ?
Any help and YOU are a genius...
Garry Jones
Sweden
PS, offendinfg code, enitre file...
<HTML>
<HEAD><TITLE>Test</TITLE>
</HEAD>
<BODY style="BACKGROUND: none transparent scroll repeat 0% 0%; MARGIN:
0px">
<script language="JavaScript" type="text/javascript">
function checkform ()
{
if (document.regfrms.cgbx.itm1.checked == false &&
document.regfrms.cgbx.itm2.checked == false){
alert( "You have to choose one" );
document.regfrms.cgbx.itm1.focus();
return false ;
}
return true ;
}
</script>
<FORM action="dosomething.php" method="post" name="regfrms"
onSubmit="return checkform()">
<TABLE width="600" border="1" cellspacing="0" cellpadding="2">
<tr>
<td >
<input title="This is item 1" type="radio" id="itm1" value="yes"
name="cgbx" >
Item 1
<br>
<input title="This is item 2" type="radio" id="itm2" value="yes"
name="cgbx" >
Item 2
<br>
</td></tr>
<td width="600" >
<input type="Submit" value = "Ok">
<input type="button" value="Not OK" onClick="history.back()">
</td>
</tr>
</table>
</form>
</BODY>
</HTML>
but not Firefox.
function checkform ()
{
if (document.regfrms.cgbx.itm1.checked == false &&
document.regfrms.cgbx.itm2.checked == false){
alert( "You have to choose one" );
document.regfrms.cgbx.itm1.focus();
return false ;
}
return true ;
}
It checks the values of 2 radio buttons and if neither have been
pressed it alerts the user.
See this for yourselves....
http://www.morack.se/firedfox.html
So the question (before I request the British Government to make FOX
hunting compulsory) is how does firefox handle the checked status of
radio buttons..... ?
Any help and YOU are a genius...
Garry Jones
Sweden
PS, offendinfg code, enitre file...
<HTML>
<HEAD><TITLE>Test</TITLE>
</HEAD>
<BODY style="BACKGROUND: none transparent scroll repeat 0% 0%; MARGIN:
0px">
<script language="JavaScript" type="text/javascript">
function checkform ()
{
if (document.regfrms.cgbx.itm1.checked == false &&
document.regfrms.cgbx.itm2.checked == false){
alert( "You have to choose one" );
document.regfrms.cgbx.itm1.focus();
return false ;
}
return true ;
}
</script>
<FORM action="dosomething.php" method="post" name="regfrms"
onSubmit="return checkform()">
<TABLE width="600" border="1" cellspacing="0" cellpadding="2">
<tr>
<td >
<input title="This is item 1" type="radio" id="itm1" value="yes"
name="cgbx" >
Item 1
<br>
<input title="This is item 2" type="radio" id="itm2" value="yes"
name="cgbx" >
Item 2
<br>
</td></tr>
<td width="600" >
<input type="Submit" value = "Ok">
<input type="button" value="Not OK" onClick="history.back()">
</td>
</tr>
</table>
</form>
</BODY>
</HTML>