Javascript 显示其下文本框的值
我想在它下面的文本框中写下值,我该怎么做?提前谢谢 我写了以下代码:Javascript 显示其下文本框的值,javascript,html,textbox,Javascript,Html,Textbox,我想在它下面的文本框中写下值,我该怎么做?提前谢谢 我写了以下代码: <html> <head> <script language="javascript"> function show (text){ document.write("text"); } </script> </head> <body> <input type=t
<html>
<head>
<script language="javascript">
function show (text){
document.write("text");
}
</script>
</head>
<body>
<input type=textbox name=textbox value="Insert Name"/>
<input type=button name=button value="OK" onclick=show(textbox.value)/>
</body>
</html>
首先:document.write替换文档内容,使用window.alert等
接下来,考虑其中包含的字段,然后使用Stuff.Fr..TrimeBox。
这是除了其他脚本错误之外的错误:首先:document.write替换文档内容,使用window.alert或类似的方法
接下来,考虑其中包含的字段,然后使用Stuff.Fr..TrimeBox。
除此之外,还有其他脚本错误:按如下方式修改html:
<input type=textbox name=textbox value="Insert Name" id="txt" />
<span id="spn"></span>
<input type=button name=button value="OK" onclick="show();" />
function show(){
document.getElementById('spn').innerHTML = document.getElementById('txt').value;
}
按如下方式修改html:
<input type=textbox name=textbox value="Insert Name" id="txt" />
<span id="spn"></span>
<input type=button name=button value="OK" onclick="show();" />
function show(){
document.getElementById('spn').innerHTML = document.getElementById('txt').value;
}
像这样的方法应该会奏效:
像这样的方法应该会奏效: