newbee1981
Programmer
Hi I have the following code that works for IE but does not for firefox or netscape. Can anyone help me convert this for firefox compatible thanks.
<script type="text/javascript">
var checkBoxes = new Array;
function setup()
{
debugger;
var oInputs = document.getElementsByTagName('input');
for ( i = 0; i < oInputs.length; i++ )
{
// loop through and find <input type="checkbox"/>
if ( oInputs.type == 'checkbox')
{
checkBoxes.push( oInputs ); // found one - store it in the oTextBoxes array
oInputs.attachEvent("onclick", checkboxClicked);
}
}
}
function checkboxClicked()
{
if (window.event.srcElement.checked)
{
// Was a mex clicked?
if (window.event.srcElement.nextSibling.innerHTML.indexOf("MEX") > 0)
{
for ( i = 0; i < checkBoxes.length; i++ )
{
// uncheck everything except the one the user selected.
if (checkBoxes != window.event.srcElement && checkBoxes.nextSibling.innerHTML.indexOf("MEX") < 0)
checkBoxes.checked = false;
}
}
else
{
// A mex one was not selected so uncheck any mex ones that are checked
for ( i = 0; i < checkBoxes.length; i++ )
{
// uncheck everything except the one the user selected.
if (checkBoxes != window.event.srcElement && checkBoxes.nextSibling.innerHTML.indexOf("MEX") > 0)
checkBoxes.checked = false;
}
}
}
}
</script>
<script type="text/javascript">
var checkBoxes = new Array;
function setup()
{
debugger;
var oInputs = document.getElementsByTagName('input');
for ( i = 0; i < oInputs.length; i++ )
{
// loop through and find <input type="checkbox"/>
if ( oInputs.type == 'checkbox')
{
checkBoxes.push( oInputs ); // found one - store it in the oTextBoxes array
oInputs.attachEvent("onclick", checkboxClicked);
}
}
}
function checkboxClicked()
{
if (window.event.srcElement.checked)
{
// Was a mex clicked?
if (window.event.srcElement.nextSibling.innerHTML.indexOf("MEX") > 0)
{
for ( i = 0; i < checkBoxes.length; i++ )
{
// uncheck everything except the one the user selected.
if (checkBoxes != window.event.srcElement && checkBoxes.nextSibling.innerHTML.indexOf("MEX") < 0)
checkBoxes.checked = false;
}
}
else
{
// A mex one was not selected so uncheck any mex ones that are checked
for ( i = 0; i < checkBoxes.length; i++ )
{
// uncheck everything except the one the user selected.
if (checkBoxes != window.event.srcElement && checkBoxes.nextSibling.innerHTML.indexOf("MEX") > 0)
checkBoxes.checked = false;
}
}
}
}
</script>