Query User - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Query User

GameFreak7744GameFreak7744 Posts: 36Member
Is it possible to use Java Script to question if a user really wants to follow a link, and then follow it if they say yes, and cancel if they say no?

Thanks in advance for any help.
~Joey~

Comments

  • zibadianzibadian Posts: 6,349Member
    : Is it possible to use Java Script to question if a user really wants to follow a link, and then follow it if they say yes, and cancel if they say no?
    :
    : Thanks in advance for any help.
    : ~Joey~
    :
    Yes, it's possible. You can do this by setting the onclick() event of the links, or by placing a function call in the link's href. In the javascript function you then ask the user to proceed. If he doesn't do nothing, otherwise open the page using the window.location property. See http://www.w3schools.com/htmldom/obj_win_location.asp for more info and examples.
  • GameFreak7744GameFreak7744 Posts: 36Member
    : Yes, it's possible. You can do this by setting the onclick() event of the links, or by placing a function call in the link's href. In the javascript function you then ask the user to proceed. If he doesn't do nothing, otherwise open the page using the window.location property. See http://www.w3schools.com/htmldom/obj_win_location.asp for more info and examples.
    :

    Thanks for the help.
    I'm pretty clueless about this whole thing, so please bear with me. If I leave in the href of the links, then they just follow normally, and if I remove it they stop acting like links, with the mouse pointer not changing when placed over them, and no formatting changes.
    Am I doing something wrong?
  • mac_doggiemac_doggie Posts: 488Member
    : : Yes, it's possible. You can do this by setting the onclick() event of the links, or by placing a function call in the link's href. In the javascript function you then ask the user to proceed. If he doesn't do nothing, otherwise open the page using the window.location property. See http://www.w3schools.com/htmldom/obj_win_location.asp for more info and examples.
    : :
    :
    : Thanks for the help.
    : I'm pretty clueless about this whole thing, so please bear with me. If I leave in the href of the links, then they just follow normally, and if I remove it they stop acting like links, with the mouse pointer not changing when placed over them, and no formatting changes.
    : Am I doing something wrong?
    :

    If you don't have an href an anchor stops acting like a link indeed. so why use the onclick You can also put JavaScript in the href by typing JavaScript: in it see my example below:

    Try this:
    [code]
    Go to google

    [/code]
    ;-)
    -mac-
    mailto:[email protected]
    the Netherlands...


Sign In or Register to comment.