日期:2014-05-16  浏览次数:20377 次

单击某div变成输入框修改div值的实现
我想单击一个容器(如span、div)时,该容器变成一个输入框
然后修改该容器的值
这个效果很多网站有
是否有个比较标准的方法?

------解决方案--------------------
<div id= "one " onclick=open()> </div>


js======================

document.getElementBynames( "one ")[0].value= "你想要改变的东西```` "
------解决方案--------------------
<body bgcolor= "#CCCCCC ">

<input readonly style= "width:100px;overflow:visible;border:solid black px;background-color:transparent; "
ondblclick= "this.readOnly=false;this.style.backgroundColor= ' ';this.select();this.focus(); "
onblur= "this.readOnly=true;this.style.backgroundColor= 'transparent '; ">
</body>