简体   繁体   中英

How can I block a repeat action in a button click?

I create a website intro page in HTML. I click a button to redirect the website home page. Now I click two or more times, meaning that the website opens twice or more. I want a home page only. How can I block that button when a home page is open?

Shouldn't you be redirecting within the same windows instead of opening new windows each time the button is clicked?

use the following?

<input type="button" value="To Home Page" onClick="location.href='http://homepage/'" />

If you have a button in a form,

<a href="JavaScript:;" id='submit' >
 <img src= "images/remote_support.png"  width="140px" height="60px" style="position: absolute; top: 450px; left: 1000px;" />
</a>????????????????????????????????????????

With JavaScript/ jQuery just submit form and make

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
    $(document).ready(function(){
        $('#submit').click(function(){
            newPopup('livesupport:8080/…');
            $('#submit').hide();
        });
    });
</script>

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