所发生的只是它闪烁了一秒钟,我想让我的按钮可见,但它不打印 hello world 并且它不会停留在那里只是闪烁。
<html>
<head>
<script src="Document.js"></script>
<script type="text/javascript">
function All() {
var name = document.getElementById("search");
visible()
}
function visible() {
document.getElementById("back").style.visibility = "visible";
David()
}
function David() {
if (name === "David") {
Document.write(
"Hello World"
);
}
}
</script>
</head>
<body onload=" invisible()">
<center>
<h2>Enter A Last Name</h2>
<form>
<input style="width: 300px;position: relative;top: 100px;" id="search" type="textbox" name="search">
<input style="position: relative;top: 100px;" type="submit" value="search" name="button" onClick="All()">
<input style="position: relative; right: 900px;" id="back" type="submit" value="Back" name="button" onClick="">
</form>
</center>
</body>
</html>
此外,这onload=" invisible()"
只是调用一个函数,<script src="Document.js"></script>
但我没有任何问题,它所做的只是在页面加载时使按钮不可见,但无论如何这里是它的代码。
function invisible()
{
document.getElementById("back").style.visibility="hidden";
}