Copy link to clipboard
Copied
I have a simple javascript that works in IE, but just found out it does not work in firefox
It is just a dropdown form field that then populates a textbox with the value of the dropdown box
function displaytime() {
document.Form1.timedisplay.value = document.Form1.Time.options.value;
return;
}
In IE it works, but in Firefox, the timedisplay textbox displays as 'undefined'
Any ideas of how ot define these variables for firefox
thanks!
Copy link to clipboard
Copied
Hi,
Try like this,
<script language="javascript">
function displaytime()
{
var timeObj=document.getElementById("Time");
document.Form1.timedisplay.value = timeObj.value;
return;
}
</script>
<form name="Form1">
<input type="text" name="timedisplay" value="" /><br>
<select id="Time" name="Time" onChange="displaytime();">
<option value="One">1</One>
<option value="Two">2</One>
<option value="Three">3</One>
<option value="Four">4</One>
<option value="Five">5</One>
</select>
</form>
HTH
Copy link to clipboard
Copied
thanks for the response - it would probably work.
I ended up using this:
function displaytime() {
document.forms['Form1'].elements['timedisplay'].value = document.forms['Form1'].elements['Time'].value;
return;
}
just changing the syntax slightly got firefox to work
thanks