Forum Moderators: open

Message Too Old, No Replies

can someone tell me why this doesnt work in Firefox 1.0.7

         

smagdy

3:39 pm on Oct 9, 2005 (gmt 0)

10+ Year Member



Hello all, can someone tell me why this doesnt work in Firefox 1.0.7?

function check_name()
{
//CHECK if NAME empty

if(announce.name.value.length == 0)
{
getID = document.getElementById("error_name");
getID.className = 'yes_error';
}

else
{
getID = document.getElementById('error_name');
getID.className = 'no_error';
}
}

Thanks in advance

RonPK

3:53 pm on Oct 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In announce.name.value.length the word 'name' is ambiguous. It can refer to the name property of the form called 'announce', and it can refer to a field called 'name' in the form called 'announce'.

smagdy

5:51 pm on Oct 9, 2005 (gmt 0)

10+ Year Member



Thanks but i dont think this is just the problem cuz ive this also not working.....

function check_tel()
{
//CHECK if telfon empty

if(announce.tel.value.length == 0)
{
getID = document.getElementById('error_tel');
getID.className = 'yes_error';
}

else
{
getID = document.getElementById('error_tel');
getID.className = 'no_error';
}
}

any clue?

Thanks in advance

smagdy

5:52 pm on Oct 9, 2005 (gmt 0)

10+ Year Member



oh and both working fine in IE 6

RonPK

6:28 pm on Oct 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What if you address the form this way:

document.forms['announce'].tel.value

or

document.announce.tel.value

Bernard Marx

7:31 pm on Oct 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



True. Don't name your form elements using anything in the form's default namespace
including: submit, name, action,.. etc

The problem itself may have nothing to do with script at all. It may be rather that changing the classNames of these elements has no effect in browsers other than IE.

Have you tried using these classNames manually to see if you get the desired effect?

smagdy

8:18 pm on Oct 9, 2005 (gmt 0)

10+ Year Member



thanks, adding the word "document." have done it :)