<form method="POST" name="submitForm2" >
    <div align="center">
        <input type="submit" name="goto" value="Logon" onClick="encode()">
[code=JScript] <script>
            function encode(){ 
                alert("System Logout."); 
            }
         </script>
    </div> 
</form>[/code]

解决方案 »

  1.   

    上面的代码在opera9.24下没有问题
      

  2.   

    我opera的版本是9.27 international版本 ,简体中文,未作任何修改。就是进不去……
      

  3.   

    下面是opera错误控制台提示的信息~能看懂所有英文单词,连起来就不认识了……JavaScript - http://192.168.1.45/
    Event thread: click
    Error:
    name: ReferenceError
    message: Statement on line 1: Reference to undefined variable: encode
    Backtrace:
      Line 1 of  script 
        encode();
      At unknown location
        [statement source code not available]
    JavaScript - http://192.168.1.45/
    Inline script compilation
    Syntax error while loading: line 450 of inline script at http://192.168.1.45/ : 
            document.submitForm2.goto.click();
      

  4.   

    等等你的哪个函数是写在js文件里吗?若是的话有可能是js文件还没有被下载,Reference to undefined variable: encode 说明哪个函数没有被定义。
      

  5.   

    还有一个错误
    document.submitForm2.goto.click();
    这是ie下才支持的,改成
    encode();
      

  6.   

    <form method="POST" name="submitForm2" >
      <div align="center">
        <input type="button" name="goto" value="Logon" onClick="encode()">
      </div>
    </form>