[Javascript] RE: Changing single click on listboxes to ctrl-click (Ben Curtis)

Jay Lepore admin at myinternethandyman.com
Mon Jul 23 16:55:29 CDT 2001


Not sure who sent me this code, but it didn't do anything at all.
Behaves just like a normal listbox ?

Thanks 4 the effort though.

Jay at myinternethandyman.com

<html>
<head>
<script language=3D"javascript">
<!--
	var selArray =3D new Array();
	function checkSelected(selObj){
		for(i=3D0;i<selObj.length;i++){
			if(selObj.options[i].selected){
				if(selArray[i] !=3D "<undefined>" &&
selArray[i]=3D=3Dtrue)
					selArray[i] =3D false;
=09
				else
					selArray[i] =3D
selObj.options[i].selected;			=09
			}
		}
		for(j=3D0;j<selArray.length;j++){
			if(selArray[j])
				selObj.options[j].selected=3Dtrue;
			else
				selObj.options[j].selected=3Dfalse;
		}
	}
//-->
</script>
</head>
<body>
<form>

<select name=3D"sel1" multiple style=3D"width:100;height:200" =
onChange=3D"checkSelected(this)"> <option>One <option>Two <option>Three
<option>Four <option>Five <option>Six <option>Seven <option>Eight
<option>Nine <option>Ten </select> </form> </body> </html>




More information about the Javascript mailing list