Click to See Complete Forum and Search --> : Netscape Help


ollmorris
01-03-2003, 04:29 PM
I have code which works in Internet Explorer but not Netscape Navigator 4. Please help:


var font=form.font.value;
var size=form.font_size.value;
var colour=form.font_colour.value;


(font, font_size, and font_colour refer to drop down menu's)

Thanks

swon
01-03-2003, 04:47 PM
Try it with document.form.font_colour.value; etc.

ollmorris
01-04-2003, 02:13 AM
I tried


document.FORMNAME.ELEMENTNAME.value;


but it didn't work in NETSCAPE. How can I get it too work?

ollmorris
01-04-2003, 07:46 AM
Sorry Dave I tried yours but I guess my rubbish JS skills was what couldn't get it to work. Could you explain the elements in the code you gave me.

Thanks

khalidali63
01-04-2003, 08:00 AM
the code you have posted,what are the elements after the form e.g
form.font.size?

are you trying to change the font size in a particular element?

because the pattern posted above does work with both IE and NS,therefor it must be what you are trying to do that is causing errors.

ollmorris
01-04-2003, 08:04 AM
font, font_size, and font_colour are drop down menu's.

Thanks

khalidali63
01-04-2003, 08:14 AM
Take a look at the code below and see what you are doing different.
It works in NS4+,NS6+ and IE browsers


<script>
function processForm(){
var obj =document.frm.fontList;
var index = obj.selectedIndex;
var val = obj[index].value;
if(val!="-1"){
alert("Value selected = "+val);
}
}
</script>
</head>

<body>
<form name="frm">
<select style="width:100pt;" name="fontList" onchange="processForm();">
<option value="-1">Select font type
<option value="times">Times
<option value="serif">Serif
<option value="sansserif">Sans Serif
</select>
</form>

ollmorris
01-04-2003, 09:00 AM
thanks very much guys. Can any of you tell me how I can select something in a text box and then set the initial value of the prompt to what the user has selected.

Thanks so much for everyone who helps me out. It is greatly appreciated and I learn each time.