Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Select box blur
- From: javascript@xxxxxxxxxx (Rodney Myers)
- Subject: [Javascript] Select box blur
- Date: Fri, 14 Sep 2001 18:06:26 +0100
Mark
Tired of solving my own problems today, so I had a go at yours!
This "works" in my IE5.5 and NN4.7 but behaves differently.
IE scrolls to the bottom, NN to the top, after clicking an option
NN did not trigger restore function until mouse clicked away form select - the
first time, but thereafter restored the selections immediately after a click.
Good thing about it is it uses very old type code, but that is probably the bad
thing about it too!. I have no doubt others could do better.
Rodney
<html><head>
<title>Multi List that does not allow selection</title>
</head>
<body onload="storeMulti()">
<script language="JavaScript">
var A= new Array();
function storeMulti(){
var List=window.document.forms[0].mySelect;
var myOptions=List.options;
for(var i=0;i<myOptions.length;i++)
{A[i]=myOptions[i].selected;}
}
function restoreMulti(List){
var myOptions=List.options;
for(var i=0;i<myOptions.length;i++)
{myOptions[i].selected=A[i];}
}
</script>
<form method='post'>
<select name="mySelect" size="10" onChange="restoreMulti(this)" multiple>
<option>aaaaaaa</option>
<option SELECTED>bbbbbbb</option>
<option>ccccccc</option>
<option SELECTED>ddddddd</option>
<option>eeeeeee</option>
<option>fffffff</option>
<option>ggggggg</option>
<option SELECTED>hhhhhhh</option>
<option>iiiiiii</option>
<option>Aaaaaaa</option>
<option>Bbbbbbb</option>
<option>Ccccccc</option>
<option>Ddddddd</option>
<option SELECTED>Eeeeeee</option>
<option>Fffffff</option>
<option>Ggggggg</option>
<option>Hhhhhhh</option>
<option>Iiiiiii</option>
<option>AAaaaaa</option>
<option SELECTED>BBbbbbb</option>
<option>CCccccc</option>
<option>DDddddd</option>
<option>EEeeeee</option>
<option>FFfffff</option>
<option SELECTED>GGggggg</option>
<option>HHhhhhh</option>
<option>IIiiiii</option>
<option>AAAaaaa</option>
<option>BBBbbbb</option>
<option>CCCcccc</option>
<option>DDDdddd</option>
<option>EEEeeee</option>
<option>FFFffff</option>
<option>GGGgggg</option>
<option>HHHhhhh</option>
<option>IIIiiii</option>
</select>
</form>
</body></html>
Mark Christie wrote:
> Dear List,
> I have a requirement for a select box to be disabled, i.e., not to change
> the selections within it, but to be able to use its scroll bars. I've been
> able to do this with an onclick='this.blur()' on textarea elements to get
> the desired results. But that doesn't work that way on a select box, and
> I've also tried onclick, onselect, and onfocus to no avail.
> Any suggestions?
>
> Regards,
> -Mark C.
>
--
Shop@ssistant Add-ons and Developer Workshops
http://www.aflyingstart.net/addons/
Enquiries regarding Shop@ssistant Classic training :
Call 01256 880770
Rodney Myers
Based in Oxford, England
Technical Director, Shop@ssistant eCommerce Solutions
- References:
- [Javascript] Select box blur
- From: Mark Christie
- [Javascript] Select box blur
- Prev by Date: [Javascript] Select box blur
- Next by Date: [Javascript] Select box blur
- Previous by thread: [Javascript] Select box blur
- Next by thread: [Javascript] Select box blur
- Index(es):