Non Coder Needs help with simple script!

Discussion in 'JavaScript' started by HJMAX007, Jun 12, 2008.

  1. #1
    Hello everyone and thanks in advance for all help given!

    All I know is very basic html and I need help with a simple script that I am trying to construct.

    Here is what I want to do:

    1. Person clicks on my "Yes" button.
    2. A pop up comes up with a message on it.
    3. On the pop up is an "OK" button and when pushed I want it to go to a specific URL.

    OK, using the below code I can get the pop up to come up, but after pushing the "OK" button on the pop up nothing happens(no redirect to the desired URL)

    Here is the code I am using.

    <a herf="http://www.DESIRED URL.com" onclick="alert('Don't Forget To Enter Your E-Mail!')"><img border="0" src="...images/yes.png" width="131" height="39"></a>

    Any help would be appreciated!
    Thanks!:)
    Hugh
     
    HJMAX007, Jun 12, 2008 IP
  2. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #2
    try
    <a onclick="alert('Don't Forget To Enter Your E-Mail!');window.location='http://www.DESIRED URL.com'"><img border="0" src="...images/yes.png" width="131" height="39"></a>
    Code (markup):
    not sure if it will work or not :p
     
    crath, Jun 12, 2008 IP
  3. HJMAX007

    HJMAX007 Peon

    Messages:
    203
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks Crath for trying,(much appreciated!) but it doesn't work. The button is just dead. With my code above the pop up opens, but then no redirect.:confused:
     
    HJMAX007, Jun 12, 2008 IP
  4. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #4
    alrighty
    add this above </head>
    <script type="text/javascript">
    	function gogo(){
    		alert("Don't Forget to Enter Your E-Mail!");
    		window.location="http://www.Site Here.com";
    	}
    </script>
    Code (markup):
    and then, for your link just make it

    <a href="#" onClick="gogo();">stuff</a>
     
    crath, Jun 12, 2008 IP