大家好,欢迎来到IT知识分享网。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "HTML://www.w3.org/TR/xHTML1/DTD/xHTML1-transitional.dtd"> <HTML xmlns="HTML://www.w3.org/1999/xHTML"> <head> <meta HTML-equiv="Content-Type" content="text/HTML; charset=gb2312" /> <meta name="author" content="wuleying"> <title>双击文字后实现编辑文本功能</title> <style> input.t {border:1px solid #fff;background:#fff;} input.s {border:1px solid #369;background:#fff;} </style> </head> <body> <input class="t" id="test" readonly value="这里是标题,双击文字后实现编辑文本功能" /><input type="submit" value="修改" style="display:none;" id="submit" /> <script type="text/javascript"> var test = document.getElementById("test"); var mysubmit = document.getElementById("submit"); test.ondblclick = function() { this.readOnly = false; this.className = "s"; mysubmit.style.display = ""; } mysubmit.onclick = function() { test.readOnly = true; test.className = "t"; this.style.display = "none"; } </script> </body> </HTML>
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://haidsoft.com/157059.html