|
From: Jason L. <ja...@go...> - 2000-11-24 16:51:22
|
*The following works in IE but not in NS*
I am trying to replace a layer within a table using the setURL() method. I
have a form with an onChange handler for a select box. When the user selects
and option, a form will be submitted and using the the setURL() method, will
load the appropriate info into the formDIV. This works great in IE, but NS
does not show the newly loaded URL. The cgi simply returns the form element
with a new select box which is populate with the new values. I have tried
variations of placing the <div> tag outside ofthe <td> and <tr> tags, but it
does not work as expected. I have also tried putting the <form> elements
outside of the <div> to see if that was efecting NS, but it had no effect.
The only way I can currently get this app to work is to create the entire
form dynamically, but this is not really effecient since I will have other
form elements (ie. name, address, phone, etc..) and/or create separate DIVS
for the various form elements... (arrgh). I could also create a static table
and then only dynamically create the form element that I wish to use the
setURL() on, however, there is no way that I can guarantee the 'placement'
of the element on the form.
Is that confusing? Anyway, here is the code:
------------------------------------------------------------
DynAPI.onLoad=function() {
testLayer=DynAPI.document.all["testDIV"]
testLayer.setBgColor('#ffffcc')
testLayer.moveTo(10,125)
testLayer.setSize(225,225)
testLayer.setVisible('true')
formLayer=DynAPI.document.all["formDIV"]
}
function submitForm() {
formLayer.setURL('rgb.cgi?color='+formLayer.doc.myForm.rgb.options[formLayer
.doc.myForm.rgb.selectedIndex].value)
}
</script>
</head>
<body bgcolor="#ffffff">
<div id="testDIV" style="position: absolute; visibility: hidden">
<table border="1">
<tr>
<td>Please Select:</td>
</tr>
<tr>
<td>
<div id="formDIV" style="position: relative;">
<form name="myForm">
<select name="rgb" onChange="submitForm()">
<option value="red">Red
<option value="blue">Blue
<option value="green">Green
</select>
</form>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>
----------------------------------------------------------------------------
----
|