HTML 表单输入
HTML form input
我有这个 javascript 代码:
function othername() {
var input = document.getElementById("formName".value);
alert('Thanks for filling that out,' + ' ' + input + '!')
}
还有这个 html 代码:
<form id="form" onsubmit="return false;">
<input type="text" id="formName"/>
<input type="submit" onclick="othername();" />
我做错了什么?
<form id="form" onsubmit="return false;">
<input type="text" id="formName"/>
<input type="submit" onclick="othername();" />
</form>
<script>
function othername() {
var input = document.getElementById("formName").value;
alert('Thanks for filling that out, ' + input + '!')
}
</script>
注意右括号。
我有这个 javascript 代码:
function othername() {
var input = document.getElementById("formName".value);
alert('Thanks for filling that out,' + ' ' + input + '!')
}
还有这个 html 代码:
<form id="form" onsubmit="return false;">
<input type="text" id="formName"/>
<input type="submit" onclick="othername();" />
我做错了什么?
<form id="form" onsubmit="return false;">
<input type="text" id="formName"/>
<input type="submit" onclick="othername();" />
</form>
<script>
function othername() {
var input = document.getElementById("formName").value;
alert('Thanks for filling that out, ' + input + '!')
}
</script>
注意右括号。