I have a simple Javascript code which I tried running on Internet explorer but was unable to . The same code runs on Mozilla Firefox. I have a lot of such code which does not run on the explorer. Can anyone please let me know if Javascript is browser specific and what can I do to make the Javascript code compatible with all browsers ? As I have already done the complete coding for my project I won’t be able to change it to make it browser compatible using libraries like JQuery etc so could you please suggest some simple way to solve the issue..
Enclosing sample code
JAVASCRIPT CODE
[CODE] <script type=”text/javascript”>
function fillvalues()
{
if (checkbox1.checked == true)
value1 = 1;
else
value1=0;
var input1= document.getElementById(‘page_1’);
input1.setAttribute(‘value’,value1);
alert(input1.value);
if (checkbox2.checked == true)
value2 = 1;
else
value2=0;
var input2= document.getElementById(‘page_2’);
input2.setAttribute(‘value’,value2);
alert(input2.value);
}
</script>[/CODE]
[CODE]<INPUT type=”checkbox” id=”checkbox1″ >
<INPUT type=”checkbox” id=”checkbox2″ >
<INPUT type=”hidden” id=”page_1″ name=”page1″ />
<INPUT type=”hidden” id=”page_2″ name=”page2″ />
<INPUT type=”button” name=”Submit” value=”Continue” onclick=”fillvalues()”/>
This code works perfectly in mozilla but not in IE . It gets stuck in the line checkbox.checked.
Would greatttlllyyyy appreciate your help
Thanks in advance