Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Select box blur


  • From: javascript@xxxxxxxxxx (Mark Christie)
  • Subject: [Javascript] Select box blur
  • Date: Fri, 14 Sep 2001 12:23:07 -0500

Rodney,
   I'll give it a shot...Thanx!

Tom,
   I did also try onChange originally, but it still wasn't playing nice...

Cheers,
   -Mark C.


-----Original Message-----
From: Rodney Myers [mailto:rodney@xxxxxxxxxxxxxxxx]
Sent: Friday, September 14, 2001 12:06 PM
To: javascript@xxxxxxxxxx
Subject: Re: [Javascript] Select box blur


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


_______________________________________________
Javascript mailing list
Javascript@xxxxxxxxxx
http://www.LaTech.edu/mailman/listinfo/javascript