【发布时间】:2017-10-12 00:38:56
【问题描述】:
我想在用户登录后将提交按钮更改为调用注销功能
<html>
<head>
/* Here I have the links for jQuery and bootstrap so, they are working properly
</head>
<body>
<form onsubmit="signIn(event)">
<input type="text" id="username" />
<input type="password" id="password" />
<input type="submit" id="connect_disconnect">
</form>
</body>
<script type="text/javascript">
function signIn() {
code ....
// Below I just change the caption of the submit button from 'Connect' to
// 'Disconnect'
$("#connect_disconnect").text('Disconnect');
}
</script>
<script type="text/javascript">
function signOut() {
code...
}
</script>
</html>
使用上面的代码,当我点击提交按钮时,即使我已经登录它也会调用signIn函数。我希望它在我已经签名时调用signOut函数。有任何想法吗? 提前感谢,如果我的问题不清楚,请告诉我。
【问题讨论】:
标签: javascript jquery html forms events