这个连接的JavaScript代码不起作用.我在关闭脚本标签之前尝试了一个警告,它显示但下面的代码我想在第三个或不同的文本字段中显示结果.
HTML:
<input type="text" id="field"><br>
<input type="text" id="str2"><br>
<input type="text" id="str3"><br>
<button onclick="concate()">Concatenate</button>
Run Code Online (Sandbox Code Playgroud)
JavaScript的:
var s=document.getElementById("field").value;
var t=document.getElementById("str2").value;
var st=document.getElementById("str3").value;
function concate()
{
st=s+t;
document.getElementById("str3").value.innerHTML=st;
console.log(st);
document.write(st);
}
Run Code Online (Sandbox Code Playgroud)