PDA

View Full Version : onClick to onSelect



skinner69
04-16-2005, 01:00 AM
How do I edit this to make the popup open on selection instead of clicking a go button? Thanks!

<form name="myform">
<div align="center"><p><select name="dir" size="1">
<option value="">Choose a Profile</option>
<option value="yooper.htm">Yooper</option>
<option value="antonov.htm">Antonov</option>
<option value="fulcrum.htm">Fulcrum</option>
<option value="oso.htm">Oso</option>
<option value="nismo.htm">Nismo</option>
<option value="smackdown.htm">Smackdown</option>
</select><input type="button" name="button" value="Go!"
onclick="openPop(this.form);"></p>
</div>
</form>

jscheuer1
04-16-2005, 06:50 AM
Try this demo out:


<form name="myform">
<div align="center"><p><select name="dir" size="1"
onChange="alert('You Chose '+this.form.dir.value);">
<option value="">Choose a Profile</option>
<option value="yooper.htm">Yooper</option>
<option value="antonov.htm">Antonov</option>
<option value="fulcrum.htm">Fulcrum</option>
<option value="oso.htm">Oso</option>
<option value="nismo.htm">Nismo</option>
<option value="smackdown.htm">Smackdown</option></p>
</div>
</form>

mwinter
04-16-2005, 04:05 PM
How do I edit this to make the popup open on selection instead of clicking a go button?To be honest, you shouldn't. I've debated this on Usenet before, so I'll just point to the relevant thread (http://groups.google.co.uk/groups?threadm=opsehr49j9x13kvk%40atlantis), rather than hash out the entire argument again.


<select ... onChange="alert('You Chose '+this.form.dir.value);">Why go from a reference to the control, to the form, then back to the original control again? Using this.value is far more efficient and logical.

Mike

jscheuer1
04-17-2005, 01:22 AM
Why go from a reference to the control, to the form, then back to the original control again?No particular reason, I was just jumping off from the original markup/code that referenced it from a button not in 'dir'. Using this.value works fine here too.