Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rating: Thread Rating: 3 votes, 3.67 average.
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-03-2008, 07:57 PM   PM User | #1
Ultragames
Regular Coder

 
Join Date: Aug 2002
Location: Oregon, United States of America
Posts: 882
Thanks: 1
Thanked 9 Times in 9 Posts
Ultragames has a little shameless behaviour in the past
Select Option Onclick Question

I want to make an option in a select menu blink a few times when you select it. My first issue, is doing any action on click/focus of a select option, (the option tag)

I tried using onclick, but this does not work in IE. (Does work in Firefox.) Then i tried onfocus, and this does not work in either. So my first question is this, how do I get an action to run when the option is selected? (By the way, onchange does not run until the select loses focus.)

My second question, though it does not need to be answered here, is how can I make the option blink? Either changing the background color a few times, or focus and defocusing the option both work, I just need it to two or three times.

Thank you.
__________________
If I'm postin here, I NEED YOUR HELP!!
Ultragames is offline   Reply With Quote
Old 05-04-2008, 12:53 PM   PM User | #2
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
I think the only real option is to make your own "select element" out of divs because I do not think that IE supports onclick or any other option on the select tag or on the option tags.

Eric
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 is offline   Reply With Quote
Old 05-04-2008, 07:24 PM   PM User | #3
Ultragames
Regular Coder

 
Join Date: Aug 2002
Location: Oregon, United States of America
Posts: 882
Thanks: 1
Thanked 9 Times in 9 Posts
Ultragames has a little shameless behaviour in the past
The select element does support onchange at the very least, and I beleive onclick, onfocus, and onblur. I was able to use onchange to run a function that used setTimeout to change the background color back and forth, there by creating the effect I was after. (Note: You should take away the focus of the select before doing this so that you can see it in IE, otherwise the selected option will stay highlighted.)

I also mentioned that onchange does not trigger until the element loses focus; I had fogotten that this only applys to inputs, textareas, and maybe checkboxes. Selects trigger onchange as soon as a new option is selected, (at least in single mode.)

Thanks for your help though.
__________________
If I'm postin here, I NEED YOUR HELP!!
Ultragames is offline   Reply With Quote
Old 05-04-2008, 11:34 PM   PM User | #4
Arty Effem
Banned

 
Join Date: May 2006
Location: England
Posts: 664
Thanks: 0
Thanked 84 Times in 84 Posts
Arty Effem can only hope to improve
Quote:
Originally Posted by Ultragames View Post
I want to make an option in a select menu blink a few times when you select it
How ever did we manage without that?
Arty Effem is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:05 PM.


Advertisement
Log in to turn off these ads.