IE/Avast against Netscape/Mozilla problem

R

Rg

Hello,
I wrote a minimal page to test browsers.
This displays 2 checkboxes and with java scripting
second checkbox should reflect changes made in the
first one. This works perfectly in internet explorer
and avast browser but it is like a non-scripted
page in netscape and mozilla.
Can somebody tell me what to write to enable scripting
in all browsers.
Thanks in advance.


<html>
<head></head>
<body>
<form id="Doc" name="Doc">
<input type="checkbox" name="Chk1" id="Chk1" onClick="Chk1Cliqued()">1
<BR>
<input type="checkbox" name="Chk2" id="Chk2" >2<BR>
</form>
</body>
<script LANGUAGE="JavaScript">
<!--
void function Chk1Cliqued() {
document.Doc.Chk2.checked=document.Doc.Chk1.checked;
}
-->
</script>
</html>
 
J

Jim Higson

Rg said:
Hello,
I wrote a minimal page to test browsers.
This displays 2 checkboxes and with java scripting
second checkbox should reflect changes made in the
first one. This works perfectly in internet explorer
and avast browser but it is like a non-scripted
page in netscape and mozilla.
Can somebody tell me what to write to enable scripting
in all browsers.
Thanks in advance.


<html>
<head></head>
<body>
<form id="Doc" name="Doc">
<input type="checkbox" name="Chk1" id="Chk1" onClick="Chk1Cliqued()">1
<BR>
<input type="checkbox" name="Chk2" id="Chk2" >2<BR>
</form>
</body>
<script LANGUAGE="JavaScript">
<!--
void function Chk1Cliqued() {
document.Doc.Chk2.checked=document.Doc.Chk1.checked;

Follow the javascript standards, here that means getting the element via
Document.getElementById.
 
C

C A Upsdell

Jim Higson said:
Follow the javascript standards, here that means getting the element via
Document.getElementById.

I find this function useful to return the object associated with an id, as
it works with older versions of IE as well:

// getObject - get object associated with an ID, or null if no object
function getObject ( id )
{
if ( id == "" )
return( null );
if ( document.getElementById && (obj =
document.getElementById(id)) )
;
else if ( document.all && (obj = document.all[id]) )
;
else /* DOM not supported, or no object */
return( null );
return( obj );
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top