点击实例文本编辑功能,哦,我们来看看双击并可以编辑内容的js代码吧
<input class="a" id="test" readonly value=www.111cn.net? type="text" /><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 = "b";
mysubmit.style.display = "";
}
mysubmit.onclick = function()
{
test.readOnly = true;
test.className = "a";
this.style.display = "none";
}
</script>
时间: 2024-10-31 17:45:51