Connecting Tech Pros Worldwide Help | Site Map

Javascript works only in IE

Angelos
Guest
 
Posts: n/a
#1: Jul 23 '05
Why does this Script does not work in Firefox ?
I am trying to make a select deselect CHECKbox function with invert
selection capability...
But this script works only in IE :(

Any Help and Ideas ?

<SCRIPT LANGUAGE="JavaScript">

function un_check(){
for (var i = 0; i < list_content_frm.length; i++) {
var e = document.list_content_frm.elements[i];
if ((e.getAttribute("className") == "Rcheck"))
{
if ((e.getAttribute("className") == "Rcheck") && (e.checked == true))
{
e.checked = false;
}
else
{
e.checked = true;
}
}
}
}
</SCRIPT>

Thanks for that !!!


Lasse Reichstein Nielsen
Guest
 
Posts: n/a
#2: Jul 23 '05

re: Javascript works only in IE


"Angelos" <angelos@redcatmedia.net> writes:

....[color=blue]
> But this script works only in IE :([/color]
[color=blue]
> <SCRIPT LANGUAGE="JavaScript">[/color]

<script type="text/javascript">
[color=blue]
> function un_check(){
> for (var i = 0; i < list_content_frm.length; i++) {[/color]

Where is the global variable "list_content_frm" declared? See:
<URL:http://jibbering.com/faq/#FAQ4_41>

Try :
function toggleChecks() {
var elems = document.forms['list_content_frm'].elements;
for (var i = 0; i < elems.length; i++) {
var e = elems[i];
if (e.className == "Rcheck") {
e.checked = ! e.checked;
}
}
}
/L
--
Lasse Reichstein Nielsen - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Closed Thread