-
disable (set to readonly) a textbox in javascript???
Hi all,
How do you set a textbox to readonly from a jscript function??
tia
tony
-
Re: disable (set to readonly) a textbox in javascript???
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
>
-
Re: disable (set to readonly) a textbox in javascript???
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
>>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks