HTML, making a button submit data to another url?

后端 未结 4 1725
北恋
北恋 2020-12-20 12:21

The following is my HTML:

4条回答
  •  离开以前
    2020-12-20 13:02

    Try the following:

    In HTML add an onclick event handler for Make a new account button:

    
            

    In JavaScript:

    function register() {
        this.action = 'register.php';
        return true;
    }
    

    If this does not work, you may try:

    function register() {
        var frm = document.getElementById("myform");
        frm.action = 'register.php';
        return true;
    }
    

    One or both of the above mentioned solution should work for you. Prefer the first approach as it is cleaner.

    Please take this as a starting point not a copy-paste solution and follow the best practices for development.

提交回复
热议问题