D
Dan Williams
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.selectedIndex).text, _
4,"Delete message?")
end if
end sub
sub fnViewMsg
Call MsgBox(form1.messages.Options(form1.messages.selectedIndex).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>
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.selectedIndex).text, _
4,"Delete message?")
end if
end sub
sub fnViewMsg
Call MsgBox(form1.messages.Options(form1.messages.selectedIndex).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>