DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   JavaScript / DHTML / AJAX (http://www.daniweb.com/forums/forum117.html)
-   -   Link confirmation (http://www.daniweb.com/forums/thread81847.html)

daddy89 Jun 25th, 2007 10:10 am
Link confirmation
 
I want to make it so when a person clicks a link it pops up asking "are you sure" and if you click no itll stop u from going further and leave u on that page and if u hit yet itll continue to a specified link (which will be specified by a php script)

~s.o.s~ Jun 25th, 2007 10:38 am
Re: Link confirmation
 
Something like this:

<html>
<head>
    <script type="text/javascript">
    var doConfirm = function(id)
    {
        var link = document.getElementById(id);
        if(confirm("Do you really want to go to Google?"))
            return true;
        else
            return false;
    }
    </script>
</head>
<body>
    <br /><br />
    <div>
    Click on <a href="http://www.google.com" id="link" onclick="return doConfirm(this.id);">this link</a> to go to google
    </div>
</body>
</html>


All times are GMT -4. The time now is 10:17 am.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC