简体   繁体   中英

Html tags doesn't work

I want to open a new html file by clicking a submit button but it doesn't work my code is here

HTML

<div class="col-sm-offset-3 col-sm-3">
                        <button id="submit" type="submit" class="btn btn-default" onclick="submitFunction()">Confirm SignUp</button>
                    </div>

JavaScript

<script type="text/javascript">
        function submitFuntion(){
            if(document.getElementById('submit').onclick){
                document.write("<a href='info.html'></a>");
            }
        }
    </script>

Place submit button inside a form tag and set its attribute action to info.html. that way when you click on submit info.html will open. No need of click event for submit button

Solution with form/submit:

<div class="col-sm-offset-3 col-sm-3">
  <form action="info.html">
    <button 
      id="submit" 
      type="submit" 
      class="btn btn-default">
        Confirm SignUp
    </button>
  </form>
</div>
<button type="submit" id="submit" class="btn btn-default" onclick="location.href='info.html'">Confirm SignUp </button>

单击提交按钮将帮助您导航到页面info.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM