By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,574 Members | 1,568 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,574 IT Pros & Developers. It's quick & easy.

Ignore DropDown Change?

P: n/a
I do not want to disable a dropdown list, I want the selection to stay
on the same selection even if a user changes the option. I think I need
to trap mouseup and keyup or something, but I am not sure, all
direction appreciated.

Thanks.

Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
<br************@hotmail.com> wrote in message
news:11*********************@l41g2000cwc.googlegro ups.com...
I do not want to disable a dropdown list, I want the selection to stay
on the same selection even if a user changes the option. I think I
need
to trap mouseup and keyup or something, but I am not sure, all
direction appreciated.

Thanks.


<body onload="setBack(document.forms['myForm'].elements['mySelect']);">
<form name="myForm">
<select name="mySelect" onchange="setBack(this);">
<option>One</option>
<option selected="selected">Two</option>
<option>Three</option>
</select>
</form>
<script type="text/javascript">
function setBack(sel)
{
if ('number' == typeof sel.previousIndex)
{
sel.selectedIndex = sel.previousIndex;
}
else
{
sel.previousIndex = sel.selectedIndex;
}
}
</script>

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #2

P: n/a
Perfect. Thanks!

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.