T
Tom
Hi all, I am a newbe to javascript so I could use your help. I checked the FAQs and searched google
but I could not resolve this problem.
My form is as follows:
<form action="serversidehandlerurl.php" method="post" onsubmit="if(document.getelementbyid) {
window.open(document.getelementbyid('pblinks').selectedindex.value); return false; }" >
<select id="pblinks" size="1" >
<option selected="selected" >Select the size...</option>
<optgroup label="Containers">
<option value="url/1" >1.0 L - $19.90</option>
<option value="url/2" >1.5 L - $29.85</option>
<option value="url/3" >2.0 L - $39.80</option>
<option value="url/4" >3.0 L - $59.70</option>
</optgroup>
</select ><br />
<input type="submit" value="Buy Now" / >
</form >
Now don't flip out this is a "Strict" XHTML site and I cannot change to "Transitional" therefore
Attribute names must be lower-case. This means that the typical JavaScript practice of capitalizing
parts of attribute names in HTML tags must go. So within tags onLoad becomes onload, onClick becomes
onclick and so on. This change should not break anything.
Also note that in Strict some elements are not allowed. For example, a form element may not have a
name= attribute, which makes it difficult to refer to by normal means. The workaround is to give
elements you want to refer to an id= attribute and then use the JavaScript getElementByID() function
to refer to them. The form itself does not need an id attribute, only the element you want to refer
to.
When I run this form I am taken to the action serversidehandlerurl.php site but the option url is
not selected. Also the window.open command does not function (i.e., a new window does not open).
Like I said I am a newbe to javascript and any help is appreciated. Thanks in advance...
Tom
but I could not resolve this problem.
My form is as follows:
<form action="serversidehandlerurl.php" method="post" onsubmit="if(document.getelementbyid) {
window.open(document.getelementbyid('pblinks').selectedindex.value); return false; }" >
<select id="pblinks" size="1" >
<option selected="selected" >Select the size...</option>
<optgroup label="Containers">
<option value="url/1" >1.0 L - $19.90</option>
<option value="url/2" >1.5 L - $29.85</option>
<option value="url/3" >2.0 L - $39.80</option>
<option value="url/4" >3.0 L - $59.70</option>
</optgroup>
</select ><br />
<input type="submit" value="Buy Now" / >
</form >
Now don't flip out this is a "Strict" XHTML site and I cannot change to "Transitional" therefore
Attribute names must be lower-case. This means that the typical JavaScript practice of capitalizing
parts of attribute names in HTML tags must go. So within tags onLoad becomes onload, onClick becomes
onclick and so on. This change should not break anything.
Also note that in Strict some elements are not allowed. For example, a form element may not have a
name= attribute, which makes it difficult to refer to by normal means. The workaround is to give
elements you want to refer to an id= attribute and then use the JavaScript getElementByID() function
to refer to them. The form itself does not need an id attribute, only the element you want to refer
to.
When I run this form I am taken to the action serversidehandlerurl.php site but the option url is
not selected. Also the window.open command does not function (i.e., a new window does not open).
Like I said I am a newbe to javascript and any help is appreciated. Thanks in advance...
Tom