我有一个注销按钮,当我单击时,我希望它进入只有登录表单的主屏幕。想象一下,就像一台PC,当您选择注销时,它将关闭会话,保存工作,然后转到登录屏幕。
退出按钮
<div id="Logout">
<a href="logout.php" id="LogoutAction"><img src="https://cdn2.iconfinder.com/data/icons/crystalproject/crystal_project_256x256/apps/exit.png"></a>
</div>
不带CSS的登录表单:
<div id="Login">
<form>
<label for="username">Username:</label>
<input type="text" id="username" name="username">
<label for="password">Password:</label>
<input type="password" id="password" name="password">
<div id="lower">
<input type="submit" value="Login">
</div><!--/ lower-->
</form>
</div>
点击按钮后我要进入登录屏幕
答案 0 :(得分:0)
href
标签中的<a>
仅在logout.php
位于相同目录时有效
尝试以下操作:
<!-- if logout.php is in the root dir-->
<a href="/logout.php" id="LogoutAction">
<!-- if logout.php is in another dir -->
<a href="/anotherDir/logout.php" id="LogoutAction">
<!-- if logout.php is in the upper dir -->
<a href="../logout.php" id="LogoutAction">
<!-- if logout.php is in a child dir -->
<a href="./childDir/logout.php" id="LogoutAction">
答案 1 :(得分:-1)