0

我的网站上有 2 个表单,而不是提交这些表单,我希望该用户在尝试提交表单时应该被简单地重定向到一个新的注册页面(我们称之为http://signup.com )。

代码如下 - 我将如何实现这一目标?

谢谢

FK


表格 1

            <form action="" class="header-signup">
                <input name="email" class="input-side" type="email" placeholder="Sign up now">
                <input type="submit" value="Go" class="btn-side">
            </form>

表格 2

            <form action="" class="signup-form">
                <input name="email" class="input-side animate-on-scroll" data-scrollanimation="fadeInLeft" type="email" placeholder="Your email address">
                <input type="submit" value="Sign Up Now" class="btn-side animate-on-scroll" data-scrollanimation="fadeInRight">
            </form> 
4

1 回答 1

1

尝试:

        <form action="" class="header-signup">
            <input name="email" id="txt-email" class="input-side" type="email" placeholder="Sign up now">
            <input type="button" value="Go" id="btn-go" class="btn-side">
        </form>
        <script>
            function moveToSignUpLocation() {
                    window.location = "[location to sign up]";
            }
            document.getElementById('txt-email').onkeydown = function(e) {
                 e = e || window.event;
                 if (e.keyCode === 13) {
                    moveToSignUpLocation();
                 }
            }
            document.getElementById('btn-go').onclick = function() {
                           moveToSignUpLocation();
            };
        </script>
于 2013-10-26T16:17:23.590 回答