Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Apr 2003
    Location
    Seoul, Korea
    Posts
    329
    Thanks
    0
    Thanked 0 Times in 0 Posts

    alert when a user click a link

    Code:
      index.html 
    <a href="next.html" name="DoNotClick"> click </a>

    I have a link like the above.

    If a user clicks the link, it will move to next.html.

    But I like to make it like the following.

    If a user click the link, it will show an alert saying "Do not click, please," and
    as the user confirms the alert, it will back to index.html.

    Thanks in Advance
    Get my greedy up

  • #2
    Regular Coder
    Join Date
    Jun 2004
    Posts
    565
    Thanks
    0
    Thanked 18 Times in 18 Posts
    Code:
    document.onclick = no_click;
    function no_click(e) {
      var target = (typeof(e) != 'undefined') ? e.target : window.event.srcElement;
      if(target.name == 'DoNotClick') {
        alert('Do not click, please');
        return false;
      }
      return true;
    }
    dumpfi

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you don't mind my asking: "What purpose could this serve?" Are you researching human behavior or something?
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,928
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Give my greedy up

    Is that not clear, Roy?

  • #5
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you don't mind my asking: "What purpose could this serve?" Are you researching human behavior or something?
    Too hilarious.


    How about:

    Code:
    <a href="index.html" onmouseover="javascript:alert('Get Lost Punk!');">Link</a>
    Last edited by jamescover; 08-31-2004 at 09:52 AM.
    "God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •