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)

Recommended Answers

All 2 Replies

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>
<html>
<body>
    Click on <a href="http://www.google.com" id="link" onclick="return confirm('Do you really want to go to Google?');">this link</a> to go to google
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.