Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling JavaScript functions directly from <OPTION>... 2

Status
Not open for further replies.

JavaStripped

Programmer
Dec 18, 2002
84
CA
Is is possible to call a JavaScript function immediately by selecting a specific
Code:
<OPTION>
value in a
Code:
<SELECT>
control (i.e., via some attribute of the
Code:
<OPTION>
element)?
E.g.:
<SELECT...>
<OPTION...attr=&quot;function()&quot;...>

[reading]I've found no such attribute mentioned anywhere, so I'm betting it doesn't exist, but I know I don't know everything, or I wouldn't be asking so many questions on this site... [bigsmile] JavaStripped
&quot;I did *not* escape. They gave me a day pass.&quot;
 
Wow! Thanks for the quick response, DoubleV! That definitely gets a star!
Hey, I'll even throw in a medal, too. [medal] JavaStripped
&quot;I did *not* escape. They gave me a day pass.&quot;
 
Funny enaugh in IE6 the option has a mouseup and click but it doesn't do anything with it:

<select id=&quot;butCancel&quot; multiple >
<option value=0 id=opt onmouseup=&quot;alert(this);&quot; onmousedown=&quot;alert(this.id);&quot;>lkjdflkjds</option>
</select>
<br>
<script>
var obj = document.getElementById('butCancel').options[0];
alert(obj.id);
for(hh in obj) {
document.write(hh + &quot;<br>&quot;)

}
</script>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top