tedd <[EMAIL PROTECTED]> wrote on 04/11/2008 02:49:21 PM:

> But the critter is dead in the water for all versions of IE -- if -- 
> I don't figure out a way around the following single statement.
> 
> document.getElementById(id).checked = true;
> 
> After reading a bunch, it seems that M$ has a better way to do things 
> (big surprise there, huh?) and thus does not use the 
> document.getElementById(id) thing that everyone else in the world 
> uses. Instead, they use something "better" and it's not documented 
> well as is typical.
> 
> So, what I need is:
> 
> if (document.getElementById)
>     {
>     document.getElementById(id).checked = true;
>     }
> else
>     {
>     <<<<< inset solution here. >>>>>>
>     }

The Javascript code below, using either Method 1 or Method 2, works fine 
in IE 7. Have you tried running it in Firefox with the error console open? 
I am wondering if there isn't a minor syntax error somewhere.

Kirk

<html><head><title></title>

<script type="text/javascript">
function checkme() {

// Method 1 - works fine in IE 7
//      if(document.forms[0].test.checked) {
//        document.forms[0].test.checked = false;
//      }
//      else {
//        document.forms[0].test.checked = true; //     }
//      }

// Method 2 - works fine in IE 7
        if(document.getElementById('test').checked) {
          document.getElementById('test').checked = false;
        } else {
          document.getElementById('test').checked = true;
        }
}
</script>
</head>
<body>

<form action="" method="post">
<input type="checkbox" name="test" id="test" onmouseover="checkme();"> 
Mouse Me
</form>

</body></head></html>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to