Hi all,
How do you set a textbox to readonly from a jscript function??
tia
tony
Printable View
Hi all,
How do you set a textbox to readonly from a jscript function??
tia
tony
u can set the disable property of the text box to true..
heres the code
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<script language="javascript">
function dodisable()
{
document.form1.txt1.disabled="true";
}
</script>
</HEAD>
<BODY>
<P> </P>
<form id=form1 name=form1>
<input type="text" value="shobha" name="txt1">
<input type="button" value="Disable Text Box" onclick="dodisable()">
</form>
</BODY>
</HTML>
"ttttony" <afarrell@tccf.net> wrote:
>
>Hi all,
>
>How do you set a textbox to readonly from a jscript function??
>
>tia
>
>tony
>
Hi,
The reply given by shobha will work fine. but if need to access the value
of the testbox on the next screen using "form.formfildname" then it won't
be available.where as if instead of the disable property you use the readonly
then the value of the foiled is available een after the form submission
document.form1.txt1.readOnly=true;
but these two solutions will work only in Internet explorer and not in netscape
according to my experience we are not able to mnake a textfiled noneditable
in netscape.
Regards
Girish
----------------------------------------------------------
"shobha" <shobhaiyer@yahoo.com> wrote:
>
>u can set the disable property of the text box to true..
>heres the code
>
><HTML>
><HEAD>
><META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
><TITLE></TITLE>
><script language="javascript">
>function dodisable()
>{
>document.form1.txt1.disabled="true";
>}
></script>
></HEAD>
><BODY>
>
><P>*</P>
><form id=form1 name=form1>
><input type="text" value="shobha" name="txt1">
><input type="button" value="Disable Text Box" onclick="dodisable()">
></form>
>
>
></BODY>
></HTML>
>
>
>
>"ttttony" <afarrell@tccf.net> wrote:
>>
>>Hi all,
>>
>>How do you set a textbox to readonly from a jscript function??
>>
>>tia
>>
>>tony
>>
>