V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐关注
Meteor
JSLint - a JavaScript code quality tool
jsFiddle
D3.js
WebStorm
推荐书目
JavaScript 权威指南第 5 版
Closure: The Definitive Guide
tangyuan
V2EX  ›  JavaScript

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

  •  
  •   tangyuan · 2013-02-04 21:36:57 +08:00 · 2969 次点击
    这是一个创建于 4092 天前的主题,其中的信息可能已经有所发展或是发生改变。
    通过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 条回复    1970-01-01 08:00:00 +08:00
    takwai
        1
    takwai  
       2013-02-04 21:40:52 +08:00   ❤️ 1
    function new() 这个是关键字,改改函数名称。
    tangyuan
        2
    tangyuan  
    OP
       2013-02-04 21:44:46 +08:00
    @takwai 果然如此!感谢takwai...
    utom
        3
    utom  
       2013-02-04 21:48:18 +08:00
    @takwai 同楼上~
    DaniloSam
        4
    DaniloSam  
       2013-02-05 13:40:59 +08:00
    new.........
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2790 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 09:56 · PVG 17:56 · LAX 02:56 · JFK 05:56
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.