2 回答
TA贡献1818条经验 获得超3个赞
click() 已定义为 javascript 方法
function SubMit() {
var userName = document.getElementById("user").value;
document.getElementById("out").innerHTML = userName;
var fName = document.getElementById("firstName").value;
var lName = document.getElementById("lastName").value;
var eMail = document.getElementById("email").value;
var p1 = document.getElementById("pass1").value;
var p2 = document.getElementById("pass2").value;
console.log(userName);
console.log(fName);
console.log(lName);
console.log(eMail);
console.log(p1);
console.log(p2);
}
function myClick() {
document.getElementById("c").innerHTML = "HELLO WORLD";
console.log("hello world");
}
<form>
<input type="text" placeholder="Username" id="user" required>
<input type="text" placeholder="First Name" id="firstName" required>
<input type="text" placeholder="Last Name" id="lastName">
<input type="email" placeholder="Email" id="email" required>
<input type="password" placeholder="Password" id="pass1" required>
<input type="password" placeholder="Confirm Password" id="pass2" required>
<button type="submit" onclick="SubMit()">SUBMIT</button>
</form>
<output id="out"></output>
<button type="button" onclick="myClick()">click me</button>
<p id="c"></p>
TA贡献1802条经验 获得超6个赞
用 div 标签更改输出标签为。
<div id="out"></div>
将 click() 重命名为任何其他名称。click() 是预定义的 js 函数,您必须在使用它之前覆盖该函数以防止点击事件。
添加回答
举报