dongrandi8411 2013-12-26 16:37
浏览 37

提交按钮不在Chrome中工作但在Firefox中工作

Hi the logout button is not working in chrome. It is working fine in Firefox. However if I press F12 and keep the developer console open then the button works. The button also works when I press enter. I'm confused. Here is my code.

HTML Code:

<form name="logoutform" method="post" onsubmit="logoutConfirmation()" action="" >
        <input type="submit" value="Logout" id="logoutbutton" name="userlogout" ><br>
    </form>

JS Code:

function logoutConfirmation()
 {
alert("Thank you. Have a nice day!");
 }

PHP Code:

if(isset($_POST['userlogout']))
    {
        setcookie('user_name', '');
        setcookie('user_id', '');
        session_destroy();
        header("Location: index.php");
    }
  • 写回答

3条回答 默认 最新

  • dtlhy0771 2013-12-26 16:40
    关注

    Define the action php file in your form like;

    <form name="logoutform" method="post" onsubmit="logoutConfirmation()" action="yourfile.php" >
            <input type="submit" value="Logout" id="logoutbutton" name="userlogout" ><br>
    </form>
    
    评论

报告相同问题?

悬赏问题

  • ¥100 支付宝批量检测实名工具
  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题