Welcome to WebmasterWorld Guest from 54.205.75.60

Forum Moderators: open

Message Too Old, No Replies

dropdown javascript not working in netscape

am I up ****'* creek...or is there a way around it?

   
11:15 am on Oct 11, 2001 (gmt 0)



function dropdown1() {
document.Anuncio.PreSubCategoria2.value='';
document.Anuncio.PreSubCategoria3.value='';
document.Anuncio.PreSubCategoria4.value='';
}
function dropdown2() {
document.Anuncio.PreSubCategoria1.value='';
document.Anuncio.PreSubCategoria3.value='';
document.Anuncio.PreSubCategoria4.value='';
}
function dropdown3() {
document.Anuncio.PreSubCategoria1.value='';
document.Anuncio.PreSubCategoria2.value='';
document.Anuncio.PreSubCategoria4.value='';
}
function dropdown4() {
document.Anuncio.PreSubCategoria1.value='';
document.Anuncio.PreSubCategoria2.value='';
document.Anuncio.PreSubCategoria3.value='';
}

There´s 4 drop downs....and when the user clicks on one of them...the other three´s values return to their original position. It doesn´t work in netscape. Anybody have any ideas why?

i called the 4 different functions with "onFocus" in their respective drop downs.

if anybody has an answer, I´d appreciate it. I´m about to right hook my computer monitor.

2:01 pm on Oct 11, 2001 (gmt 0)

10+ Year Member



Instead of:
document.Anuncio.PreSubCategoria2.value='';

try:
document.Anuncio.PreSubCategoria2.selectedIndex = 0;

See if that works.

10:49 am on Oct 15, 2001 (gmt 0)



thanks a lot for the help
...I tried that and they still don´t change in netscape.

Has anyone come across a problem similar to this one...or any other problems with validating dropdowns with javascript?

5:36 pm on Oct 19, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



EX_S suggestion is the right way to achieve the effect you're after and it worked for me in IE, NN4, and NN6.

Here's the page I wrote to test it out:


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

<script>
function drop1()
{
document.frmtest.test2.selectedIndex = 0;
document.frmtest.test3.selectedIndex = 0;
}

function drop2()
{
document.frmtest.test1.selectedIndex = 0;
document.frmtest.test3.selectedIndex = 0;
}

function drop3()
{
document.frmtest.test2.selectedIndex = 0;
document.frmtest.test1.selectedIndex = 0;
}
</script>
</head>

<body>
<form name="frmtest">
<select name="test1" onchange="drop1()">
<option>1
<option>2
<option>3
</select>
<select name="test2" onchange="drop2()">
<option>1
<option>2
<option>3
</select>
<select name="test3" onchange="drop3()">
<option>1
<option>2
<option>3
</select>
</form>
</body>
</html>

Important points to check are that your select boxes are correctly (try a html validator) nested within the appropriate form tags.