JavaScript double-click text box Edit function code _ form effects

Source: Internet
Author: User
<! DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "Html://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd "> <ptml xmlns=" html://www.w3.org/1999/xhtml "> <pead> <meta html-equiv=" Content-type "content=" text/html; charset=gb2312 "/> <meta name=" Author "content=" wuleying "> <title>javascript double-click the text box to edit the function code </title > <style> input.t {border:1px solid #fff; background: #fff;} INPUT.S {border:1px solid #369; background: #fff;} </style> </pead> <body> <input class= "T" id= "test" readonly value= "Here is the title, double-click Text to implement edit text function"/>< Input type= "Submit" value= "Modify" id= "Submit"/> <script type= "Text/javascript" > var test = Document.getelementby Id ("test"); var mysubmit = document.getElementById ("submit"); Test.ondblclick = function () {this.readonly = false; This.classname = "S"; Cloud Habitat Community Description is mainly through the control style to achieve the text style and text box style switch mysubmit.style.display = ""; } Mysubmit.onclick = function () {test.readonly = true;Test.classname = "T"; This.style.display = "None"; } </script> </body> </HTML>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

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.