文本框里面
<input type="text" name="Location_Search"  >
我原来用它的keydown事件不行,所以换了
<input type="text" name="sss_Search"  >
一共两个嘛,按一个提交一个相应的submit

解决方案 »

  1.   


    <form onsubmit="return false;">
    <input type="submit" value="第一个" onclick="say('第一个');" id="btn1"/>
    <input type="submit" value="第二个" onclick="say('第二个');" id="btn2"/>
    </form>
    <script>
    function say(str)
    {
    alert(str);
    }
    document.onkeydown=function()
    {
        if(window.event.keyCode=="13")
        {
    document.getElementById("btn2").focus();
        }
    }
    </script>
      

  2.   


    <form>
    <input type="text" id="baidu" />回车提交到百度
    <input type="text" id="google" />回车提交到谷歌
    </form>
    <script>
    var baidu=document.getElementById("baidu");
    var google=document.getElementById("google");
    baidu.onkeydown=function(evt){
        evt=evt||event;
        if(evt.keyCode==13){alert();
            this.form.action="http://baidu.com";
            this.form.submit();
        }
    }
    google.onkeydown=function(evt){
        evt=evt||event;
        if(evt.keyCode==13){alert();
            this.form.action="http://google.com";
            this.form.submit();
        }
    }
    </script>
      

  3.   

    先获得焦点在click,哎
    document.getElementById("btn2").focus();
    document.getElementById("btn2").onclick();