I have the below code from a previous post.
It works great in IE, but not at all in Firefox.
Any suggestions on how to make it work in Firefox?
<HTML>
<HEAD>
<TITLE>Untitled</TITLE>
<SCRIPT TYPE="text/javascript">
function clickonce(o)
{
if (o.checked==false)
{
o.checked = true;
return true;
}
}
function clicktwice(o)
{
if (o.checked==true)
o.checked = false;
}
</SCRIPT><SCRIPT
LANGUAGE="javascript" TYPE="text/javascript">
<!--
function changeColor(color,target) {
target.style.color = color;
}
// -->
</SCRIPT><SCRIPT
TYPE="text/javascript">
function checkChecked(obj,group)
{
var maxchecked = 2;
var chkcount = 0;
var els = obj.form.elements;
for(var i=0; i<els.length; i++)
{
if(group && els[i].type.toLowerCase()=
="checkbox
" && els[i].className==group && els[i].checked && els[i].tagName.toLowerCase
() == 'input')
{
var typ = els[i].type.toLowerCase();
if((typ == 'checkbox' || typ =='radio'))
{
if(els[i].checked)
{
chkcount++;
}
if(chkcount > maxchecked)
{
obj.checked = false;
alert('Sorry, you can select only ' + maxchecked + ' choices');
return;
}
}
}
}
view(obj);
}
</SCRIPT><SCRIPT
TYPE="text/javascript">
function show(id)
{
document.getElementById(id
).style.di
splay='';
}
function hide(id)
{
document.getElementById(id
).style.di
splay='non
e';
}
</SCRIPT><SCRIPT
TYPE="text/javascript">
function hideDiv(range){
tag = document.getElementsByTagN
ame("div")
;
for(x=0;x<tag.length; x++){
if(tag[x].getAttribute('id
').indexOf
(range) != -1){
tag[x].style.display = "none";
}
}
}
function view(id){
ge = document.getElementById('c
hoose_' + id.value);
hideDiv("choose_" + id.value.substring(0,1)); //choose_a, choose_b or choose_c
ge.style.display = "block";
}
</SCRIPT><STYLE>
body { font-family: arial;font-size: 77%;color: 808080;}
</STYLE>
<STYLE>
a:link { text-decoration: none; }
a:visited { text-decoration: none; }
a:active { text-decoration: none; }
a:hover { text-decoration: underline; color: black }
#pup {position:absolute; visibility:hidden; z-index:200; width:260; }
</STYLE>
</HEAD>
<BODY TEXT="GRAY" LINK="#0099FF" VLINK="#0099FF" ALINK="#0099FF">
<P STYLE="margin-top : -14.0pt;" ALIGN=CENTER>
<FONT FACE="Arial,Helvetica,Mona
co"><FONT SIZE="1"><!-- $MVD$:spaceretainer() --></FONT></FONT> </P
>
<P STYLE="margin-top : -14.0pt;" ALIGN=CENTER>
<FONT FACE="Arial,Helvetica,Mona
co"><FONT SIZE="1"><!-- $MVD$:spaceretainer() --></FONT></FONT> </P
>
<FORM NAME="myform">
<P>
question # 1</P>
<P>
<INPUT TYPE=CHECKBOX NAME="1" VALUE="aa" CLASS="q1" ONDBLCLICK="clicktwice(thi
s);" ONCLICK="clickonce(this);c
heckChecke
d(this,thi
s.classNam
e);"><FONT
FACE="Arial,Helvetica,Mona
co"><FONT SIZE="2"> <INPUT TYPE=CHECKBOX NAME="2" VALUE="ab" ONDBLCLICK="clicktwice(thi
s)" ONCLICK="clickonce(this);c
heckChecke
d(this,thi
s.classNam
e);" CLASS="q1" /> <INPUT TYPE=CHECKBOX NAME="3" VALUE="ac" ONDBLCLICK="clicktwice(thi
s)" ONCLICK="clickonce(this);c
heckChecke
d(this,thi
s.classNam
e);" CLASS="q1" /> <INPUT TYPE=CHECKBOX NAME="4" VALUE="ad" ONDBLCLICK="clicktwice(thi
s)" ONCLICK="clickonce(this);c
heckChecke
d(this,thi
s.classNam
e);" CLASS="q1" /></FONT></FONT></P>
<P>
<FONT FACE="Arial,Helvetica,Mona
co"><FONT SIZE="2"><!-- $MVD$:spaceretainer() --></FONT></FONT> </P
>
<P>
<!-- $MVD$:spaceretainer() --> </P>
<P ALIGN=LEFT>
</P>
<DIV>
<P ALIGN=LEFT>
<TABLE WIDTH="500" CELLPADDING="0" CELLSPACING="0" BORDER="0">
<TR>
<TD WIDTH="100%" VALIGN=TOP>
<DIV style="display:none;" id="choose_aa">
<P>
page1</P>
</DIV>
<DIV style="display:none;" id="choose_ab">
<P>
page 2</P>
</DIV>
<DIV style="display:none;" id="choose_ac">
<P>
page 3</P>
</DIV>
<DIV style="display:none;" id="choose_ad">
<P>
page 4</P>
</DIV>
<P>
<!-- $MVD$:spaceretainer() --> </TD>
</TR>
</TABLE></P>
</DIV>
<P ALIGN=LEFT>
<!-- $MVD$:spaceretainer() --> </P>
<P ALIGN=LEFT>
<!-- $MVD$:spaceretainer() --> </P>
</FORM>
<P ALIGN=CENTER>
<FONT FACE="Arial,Helvetica,Mona
co"><FONT SIZE="1"><!-- $MVD$:spaceretainer() --></FONT></FONT>
</BODY>
</HTML>
Thanks
Start Free Trial