[Javascript] making <select> tags read only

Andrew Dunn adunn at mail.interworx.com.au
Wed May 16 05:15:48 CDT 2001


Hi,
   If you are interested the X var as specified below can be set like so:

<SELECT NAME="List3" onfocus="findSelected(this)" onchange="readOnly(this)">

var curVar;

function findSelected(curObj)
{
	curVar = curObj.options[curObj.selectedIndex];
}

function readOnly(curObj)
{
	alert("You do not have permission to change this");
	curVar.selected = "1";
}

-----Original Message-----
From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
Behalf Of Rodney Myers
Sent: Wednesday, 16 May 2001 6:02 PM
To: javascript at LaTech.edu
Subject: Re: [Javascript] making <select> tags read only


Andrew,

I suppose that you mean that you set the select option and do not want
the user to change that.

If the setting of the selected option is represented by :

function setForm(form){
form.List3.selectedIndex=X; // X is a var set somehow
}

<SELECT NAME="List3" onchange="readOnlyElement(this)">



function readOnlyElement(Elem){
alert("This is read only");
setForm(Elem.form);
}

hth

Rodney

Andrew Dunn wrote:

>    How would you make a items in a select tag read only? i've tried
onFocus
> = "this.blur();", but it doesn't seem to work. Can anyone advise?
>

--
Shop at ssistant Add-ons and Developer Workshops
http://www.aflyingstart.net/addons/

Enquiries regarding Shop at ssistant Classic training :
Call 01256 880770

Rodney Myers
Based in Oxford, England
Technical Director, Shop at ssistant eCommerce Solutions

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





More information about the Javascript mailing list