older
V2EX  ›  问与答

麻烦帮我看一下这段 JS 代码

  •  
  •   older · May 25, 2016 · 3031 views
    This topic created in 3814 days ago, the information mentioned may be changed or developed.
    function SendMsg()
    {
    location = "http://www.oreilly.com";
    }
    <FORM name="myform" id="myForm" method="post" action="ProductsParamValueAdd.asp">
    <button class="submit" type="submit" id="ydSubmit" onclick="SendMsg();">确 定</button>
    </FORM>

    为什么点击按钮转不过去?
    5 replies  •  2016-05-25 10:22:52 +08:00
    banricho
    banricho
    May 25, 2016 via Android❤️1
    1
    location.href
    coolzjy
    coolzjy
    May 25, 2016
    2
    你到底是要跳 ProductsParamValueAdd.asp 还是 http://www.oreilly.com
    older
    older
    OP
    May 25, 2016
    3
    onclick="SendMsg(); return false;"

    加了 return false 就好了,谢谢
    xiamx
    xiamx
    May 25, 2016
    4
    楼主 你的教程基本上已经是 10 年前的
    xxppxiaowei
    xxppxiaowei
    May 25, 2016
    5
    type =button
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1307 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 19:58 · PVG 03:58 · LAX 11:58 · JFK 14:58
    ♥ Do have faith in what you're doing.