推荐关注
Meteor
JSLint - a JavaScript code quality tool
jsFiddle
D3.js
WebStorm
推荐书目
JavaScript 权威指南第 5 版
Closure: The Definitive Guide
tangyuan

通过js实现一个form两个提交动作失败

  •  
  •   tangyuan · Feb 4, 2013 · 3657 views
    This topic created in 4889 days ago, the information mentioned may be changed or developed.
    通过chrome的developer tool监控被告知说:
    Uncaught SyntaxError: Unexpected token new find:7
    Uncaught SyntaxError: Unexpected token )

    下面的代码都是正确的,难道是Python bottle的tpl模板文件无法陷入javascript吗?
    js部分
    <script type="text/javascript">
    function new()
    {
    document._form.action="/new";
    document._form.submit();
    }

    function update()
    {
    document._form.action="/update";
    document._form.submit();
    }
    </script>

    html部分
    <form name="_form" method="POST" action="">
    <input type="button" name="create_record" id="create_record" value="Create" onclick="new();" />
    <input type="button" name="update_record" id="update_record" value="Update" onclick="update();" />
    </form>
    4 replies    1970-01-01 08:00:00 +08:00
    takwai
        1
    takwai  
       Feb 4, 2013   ❤️ 1
    function new() 这个是关键字,改改函数名称。
    tangyuan
        2
    tangyuan  
    OP
       Feb 4, 2013
    @takwai 果然如此!感谢takwai...
    utom
        3
    utom  
       Feb 4, 2013
    @takwai 同楼上~
    DaniloSam
        4
    DaniloSam  
       Feb 5, 2013
    new.........
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5661 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 92ms · UTC 03:00 · PVG 11:00 · LAX 20:00 · JFK 23:00
    ♥ Do have faith in what you're doing.