-9

我不知道问题是什么,但是 JavaScript 没有被执行!我尝试了很多次,但我没有看到任何错误。

<html>
<head>
<title>Log In Page</title>
<script>
function myf()
{
document.getElementById("name").disabled=true;
document.getElementById("reason").disabled=true;
document.getElementById("register").disabled=true;
document.getElementById("link").display="inline";
alert("You have successfully registered.");
}
</script>
</head>
<body bgcolor="black">
<center><h1 style="font-family:Agency FB;font-size:100px;color:#3333FF;letter-spacing:50px;text-shadow: 10px 10px 10px #FF9933;">My Profile</h1></center>
<center><p style="font-family:Ubuntu Mono Bold;color:#3333FF;">You are requested to FILL IN these particulars.</p></center>
<font color="#07C6F6" face="Arial">
<center>Enter Your Name:<input type="text" id="name"><br><br>
Why Do You Want to See This Profile:<input type="text" id="reason"><br></center>
</font>
<br>
<br>
<center><button type="button" id="register" onClick="myF()">Register Info</button><br>
<p id="link" style="font-family:Arial;display:none;"><a href="Profile.html">View Profile</a></p></center>
</body>
</html>
4

3 回答 3

1
   <button type="button" id="register" onClick="myF()">Register Info</button>

将调用函数 myF() 更改为 myf()

它会起作用的。

于 2013-10-16T06:54:12.537 回答
0

As you have wrote function in wrong format write it in the form of Camel cases you have wrote function as myf() write it as myF()...

at the place of button you have written correct write same as usually at function creation..

it is going to work

于 2013-10-16T07:03:57.990 回答
0

您只需要更正按钮的 onClick 中的方法调用。它的 myF()

于 2013-10-16T07:29:35.793 回答