Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Select option on right click

Reply
Thread Tools

Select option on right click

 
 
Dan Williams
Guest
Posts: n/a
 
      07-02-2003
I have a simple select form element object and want to be able to get it to
select whatever the user chooses when they right-click in it.

I've managed to use the following code, but on the right-click it displays
whatever was previously selected and still highlighted with the left click.

Is there a way to get a right click in the select object to perform the same
functionality as a left click? (ie. select the option)

<html>
<head>
<script language="VBScript">
<!--

sub fnDelMsg
if window.event.button = 2 then
Call MsgBox("Are you sure you wish to delete this message?" _
& vbcrlf & vbcrlf &
form1.messages.Options(form1.messages.selectedInde x).text, _
4,"Delete message?")
end if
end sub

sub fnViewMsg
Call MsgBox(form1.messages.Options(form1.messages.selec tedIndex).text, _
,"Message details")
end sub

-->
</script>

<body>
<form name="form1">
<select name="messages" size="8" onDblClick="fnViewMsg()"
onMouseDown="fnDelMsg()">
<option>Message 1</option>
<option>Message 2</option>
<option>Message 3</option>
<option>Message 4</option>
</select>
</form>
</body>
</html>


 
Reply With Quote
 
 
 
 
Dan Williams
Guest
Posts: n/a
 
      07-02-2003
Oh. Sorry about that.

Any other helpful takers?

Dan

"Bob Barrows" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> This is an asp group - server-side code questions only. You need to ask

this
> in a group with "dhtml" in its name...oh! you crossposted to
> scripting.vbscript! That group is relevant.
>
> Bob
> Dan Williams wrote:
> > I have a simple select form element object and want to be able to get
> > it to select whatever the user chooses when they right-click in it.
> >
> > I've managed to use the following code, but on the right-click it
> > displays whatever was previously selected and still highlighted with
> > the left click.
> >
> > Is there a way to get a right click in the select object to perform
> > the same functionality as a left click? (ie. select the option)
> >
> > <html>
> > <head>
> > <script language="VBScript">
> > <!--
> >
> > sub fnDelMsg
> > if window.event.button = 2 then
> > Call MsgBox("Are you sure you wish to delete this
> > message?" _ & vbcrlf & vbcrlf &
> > form1.messages.Options(form1.messages.selectedInde x).text, _
> > 4,"Delete message?")
> > end if
> > end sub
> >
> > sub fnViewMsg
> > Call
> > MsgBox(form1.messages.Options(form1.messages.selec tedIndex).text,
> > _ ,"Message details")
> > end sub
> >
> > -->
> > </script>
> >
> > <body>
> > <form name="form1">
> > <select name="messages" size="8" onDblClick="fnViewMsg()"
> > onMouseDown="fnDelMsg()">
> > <option>Message 1</option>
> > <option>Message 2</option>
> > <option>Message 3</option>
> > <option>Message 4</option>
> > </select>
> > </form>
> > </body>
> > </html>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tool to enable Right click on pages where Right click is disabled tsteinke@gmail.com Computer Support 4 08-28-2005 11:53 PM
windows explorer right click option missing D. Corn Computer Support 5 08-22-2005 10:22 PM
Right click an option an a Select object araripe Javascript 1 05-28-2005 09:56 AM
lost "right click " option in IE6 the_niner_nation Computer Support 7 11-30-2004 04:11 AM
No "New" option on right mouse click! Yonski Computer Support 2 09-23-2004 02:28 AM



Advertisments