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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select box...

Status
Not open for further replies.

ddfff

MIS
Sep 27, 2002
125
US
I have a select box and I want to restrict the user from scrolling the selections with the up and down arrows.

In other words, each selection must be selected by clicking the mouse.

I want to do this because I also have a script that will refresh the page on change, and if they quickly scroll the select box with the arrows, it sends to many requests at once for the page.

Any suggestions are welcome.

 
You'll have to write script to handle it - there's no native attribute that'll make the SELECT tag respond only to mouse events. In your SELECT tag, you'll have to call these scripts through either the [tt]onkeypress[/tt] event attribute, or the [tt]onkeydown[/tt] and [tt]onkeyup[/tt] event attributes. Or you could handle it all through [tt]onchange[/tt] - I'm not really sure which would be the better handler, to be honest.

Basically, you want to trap the user's keypress and prevent it from executing the [tt]onchange[/tt] event - you may want to ask this question over in the JavaScript forum, or go to a script site like and do a search for a pre-built script that'll handle what you're talking about.

HTH,
jp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top