dsh1956 2015-06-03 11:39
浏览 23
已采纳

当点击提交按钮时,用javascript或php到gmail.com redirict

I've this form:

<form id="form1" name="form1" method="post" action="http://gmail.com"       
    onsubmit="setTimeout(function () { window.location.reload(); }, 10)">
 <div class="form-group">
 <label for="email">E-mailadres</label>
 <input type="email" name="email" class="form-control" id="email">

</div> 
<input type="submit" value="verzenden" class="btn btn-  primary" />
</form>

I want that if someone clicks on the button, he/she will redirect to gmail.com I try target blank, but it doesn't work, does someone know a good manner to redirect with javascript or php?

EDIT: I want that if someone hit the button he/she will redirect to a new tab.

  • 写回答

4条回答 默认 最新

  • dongque1462 2015-06-03 12:12
    关注

    I agree that this scenario is a bit strange as I have no idea what you're actually trying to accomplish but, if you just want to open gmail.com in a new window when the form is submitted, this should suffice:

    <form onsubmit="window.open('http://gmail.com')">
        <div class="form-group">
            <label for="email">E-mailadres</label>
            <input type="email" name="email" class="form-control" id="email">
        </div> 
    
        <input type="submit" value="verzenden" class="btn btn-  primary" />
    </form>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 关于#网络安全#的问题:求ensp的网络安全,不要步骤要完成版文件
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥20 使用Photon PUN2解决游戏得分同步的问题
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序