Href-ing an <OPTION>

liunx

Guest
How do you HREF an <option> tag in a pull down?<br />
<br />
<br />
<br />
<form name="contact" action="cgi-bin/form.pl" method="post"><br />
<div class="formtext">TO:<select name="Contact"><br />
<option value="Support">Support</option><br />
<option value="Sales">Sales</option><br />
<option value="Webmaster">Webmaster</option><br />
</select></div> <br />
<div class="formtext">FR: <input type="text" name="user_email" size="30" value="Enter Your E-mail address here" onfocus="if (this.value.search(regEMail)) this.value='';" onblur="if (this.value.search(regEMail)) this.value='Enter Your E-mail address here';"></div> <br />
<br />
<div class="formtext"><textarea rows="7" cols="45" name="questions" wrap="virtual"></textarea></div> <br />
<div class="formtext"><input type="submit" name="submit" value="Submit"><br />
<input type="reset" value="Reset"> <br />
<input type="button" value="Close" onClick="window.close()"><br />
</div> <br />
</form> <br />
<br />
<br />
<br />
Thanks,<br />
Gandalf<br />
:D<!--content-->Dam good q? merlin, umm sorry, gandalf<br />
<br />
I link to this thread now so i can find out also, I had a play around but came up with zero.<br />
<br />
I was wondering also, I noticed that you use a close tag on your options, I never have with my code & all my books don't suggest that it is needed, Is it something more recent or do you just do it cause you just do it..? jaeman<!--content-->The site is being scripted in xhtml and all tags must be closed.<br />
<br />
HTML - XHTML<br />
<BR> = <br /><br />
<HR> = <hr /><br />
<IMG> = <img src=http://www.htmlforums.com/archive/index.php/"path" /><br />
<br />
et cetera<br />
<br />
<br />
Gandalf<br />
:D<!--content-->Thanks, Don't have much xhtml exp, will remember for future refrence... jaeman<!--content-->How do you href an <option>...? I don't understand your question at all, sorry.<!--content-->he means how do you hyper-text reference(link) an option<!--content-->This site uses:<br />
<br />
<option value="http://www.htmlforums.com">HTMLforums.com</option><br />
<br />
(for example)<br />
<br />
Peg<!--content-->Yes Pegasus, but in connection with a JavaScript. If you want to go to somewhere by just selecting and option, you need JavaScript to trigger it.<br />
A basic example:<br />
<br />
<br />
<form><br />
<select onchange="javascript: window.location = this.value;"><br />
<option value=""></option><br />
<option value="http://www.example.com">Example</option><br />
</select><br />
</form><!--content-->Originally posted by jaeman <br />
Dam good q? merlin, umm sorry, gandalf<br />
<br />
I link to this thread now so i can find out also, I had a play around but came up with zero.<br />
<br />
I was wondering also, I noticed that you use a close tag on your options, I never have with my code & all my books don't suggest that it is needed, Is it something more recent or do you just do it cause you just do it..? jaeman <br />
you should close it in html4.01 as well. your book is old and deprecated and shouldn't be used :P LOL<!--content-->Originally posted by Rydberg <br />
Yes Pegasus, but in connection with a JavaScript. If you want to go to somewhere by just selecting and option, you need JavaScript to trigger it.<br />
A basic example:<br />
<br />
<br />
<form><br />
<select onchange="javascript: window.location = this.value;"><br />
<option value=""></option><br />
<option value="http://www.example.com">Example</option><br />
</select><br />
</form><br />
So all he'd need to do is add "name="Contact" to the select value and he's set? Cool! *g* Now I know how to do it. Thanks!<br />
<br />
Peg<!--content-->huh Peg? <br />
<br />
where is name="Contact" suppose to go<!--content-->To validate in Strict XHTML you cannot use "name" in the <form> tag. It must be "id". "Name" is fine in the <select> tag.<br />
<br />
When the script is inline and fired from an event-handler there is no need to go beyond the form as it already has the reference to that form. In the same way that "this" refers to the element in which it is used, one element's event-handler can call on another form element within the same form by using the element name (that is valid in form elements)<br />
<br />
<form id="theform" action=" "><br />
<select name="themenu" size="1"><br />
<option selected="selected" value=" ">blah</option><br />
<option value=" ">blah</option><br />
<option value=" ">blah</option><br />
<option> //more menu items// </option><br />
</select><br />
<input type="button" onclick= "location = '' +<br />
themenu.options[themenu.selectedIndex ].value;" value=" Go " /><br />
</form><br />
<br />
ListerMint<!--content-->Originally posted by scoutt <br />
huh Peg? <br />
<br />
where is name="Contact" suppose to go *lol* Sorry, Scoutt. My ignorance is showing again. I used the wrong word, I think.<br />
<br />
If you can add more than one attribute to an element, then you should be able to write a combination of Rydberg's and Gandalf's scripts. Like this:<br />
<br />
<form><br />
<select onchange="java script: window.location = this.value;" name="Contact"><br />
<option value=""></option><br />
<option value="http://www.example.com">Example</option><br />
</select><br />
</form><br />
<br />
Shouldn't you? Mind you, that's not quite what this place has. The first part of the dropdown menu for the Network reads:<br />
<br />
<select name="menu1" onChange="MM_jumpMenu('parent',this,0)" class="field"><br />
<option selected>Navigate Network</option><br />
<option value="http://www.bigresources.com">BigResources.com</option><br />
<br />
And has the list of other sites below it and this in the head section:<br />
<br />
<script> <br />
function MM_jumpMenu(targ,selObj,restore){ //v3.0 <br />
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); <br />
if (restore) selObj.selectedIndex=0; <br />
} <br />
</script> <br />
<br />
*lol* And now you know why I don't use jump menus. The whole thing may as well be in Japanese for all I understand it.<br />
<br />
Peg<!--content-->well if you jump in that menu with javascript it really doesn't matter if you have a name="" in there. it won't be used for that purpose.<!--content-->you should close it in html4.01 as well. your book is old and deprecated and shouldn't be used LOL<br />
<br />
Just as i thought! Well Scoutt can you write me a book on 4.01 HTML, lmao:P<!--content-->uhhh sure, let me get right on that. LOL<!--content-->Originally posted by scoutt <br />
well if you jump in that menu with javascript it really doesn't matter if you have a name="" in there. it won't be used for that purpose. <blush> oh. I thought it did the same thing as <option selected>Navigate Network</option>, but I guess not, huh? <sigh> I'll get it right eventually, I'm sure. <br />
<br />
Peg<!--content-->
 
Back
Top