Wayniac Posted June 17, 2010 Share Posted June 17, 2010 I problem I am having is when the pop up message appears saying "Example Text". I have to click it twice for it to go away. The first time I click it, that activates the button to go to the URL stated. The second click just makes it go away. How do I merge these together so when I click "Ok", it simply goes to the specified URL? Thank you <script type="text/javascript"> function message() { if (message != 2) { alert("Example Text") } } </script> <a href="javascript:message();"><input type="image" name="submit" border="0" src="http://www.example.com/buynow.png" alt="PayPal - The safer, easier way to pay online"></a> Quote Link to comment Share on other sites More sharing options...
F1Fan Posted June 18, 2010 Share Posted June 18, 2010 What is this? if (message != 2) That is causing it. You're calling the message function again in the function. Quote Link to comment Share on other sites More sharing options...
Wayniac Posted June 21, 2010 Author Share Posted June 21, 2010 Thank you for replying F1, I tried as you said by removing the IF statement and nothing has changed. The IF statement was completely pointless to have in there, but also me removing it had no effect. It still prompts the user twice... Quote Link to comment Share on other sites More sharing options...
Alex Posted June 21, 2010 Share Posted June 21, 2010 Nothing in that code alone should called alert() twice with only one click. Is this the entire code? Quote Link to comment Share on other sites More sharing options...
haku Posted June 21, 2010 Share Posted June 21, 2010 Nothing in that code will even cause a re-direct. The OP is showing us code that is entirely irrelevant to his problem. Quote Link to comment Share on other sites More sharing options...
karpagam Posted June 21, 2010 Share Posted June 21, 2010 Hi.. Try this.. Alert(Pop up) will be coming only one time.. <script type="text/javascript"> function message() { if (message != 2) { alert("Example Text"); } } </script> <a href="#" onClick="return message();"><input type="image" name="submit" border="0" src="http://www.example.com/buynow.png" alt="PayPal - The safer, easier way to pay online"></a> Quote Link to comment Share on other sites More sharing options...
Wayniac Posted June 22, 2010 Author Share Posted June 22, 2010 Thank you everyone! karpagam, that fixed my problem entirely, thank you so much, I see what was happening now, I really appreciate everyone helping me to figure this issue out Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.