JS control method of Text field read-only or writable _javascript tips

Source: Internet
Author: User

This article illustrates the method of JS controlling the read-only or writable property of text field. Share to everyone for your reference, specific as follows:

<input id= "username" name= "userneme" type= "text" style= "width:50px" size=106>
Password: <input id= "Userpwd" Type= "text" name= "userpwd" size=106 style= "width:50px" >
<input name= "content" type= "checkbox") "Value=" CheckBox "onclick=" Changecheck () "/>
Anonymous (Registration-free)
<script language=" JavaScript ">
function Changecheck ()
var Aa=document.getelementbyid ("username");
var Bb=document.getelementbyid ("Userpwd");
var Cc=document.getelementbyid ("content");
if (cc.checked)
Aa.disabled = true;
Bb.disabled = true;
aa.disabled = false;
bb.disabled = false;


Read-only and not available on the above generally can not use the Read only, you can choose the appropriate
There is no onchange event in the CheckBox control of HTML, only radio, checkbox only onclick event

More readers interested in JavaScript-related content can view this site: "JavaScript in the JSON Operation tips Summary", "JavaScript switching effects and techniques summary", "JavaScript Search Algorithm Skills summary", " JavaScript animation effects and tips Summary, "JavaScript Error and debugging skills Summary", "JavaScript data structure and algorithm skills summary", "JavaScript traversal algorithm and Skills summary" and "JavaScript Mathematical operation Usage Summary"

I hope this article will help you with JavaScript programming.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.