kamal213 Posted May 11, 2011 Share Posted May 11, 2011 Hi guys, I am looking for a <script> which will display a link after 5secs/5day/5months. I got a script of the w3c tutorial see below. <html> <head> <script type="text/javascript"> function timeMsg() { var t=setTimeout("alertMsg()",3000); } function alertMsg() { alert("Hello"); } </script> </head> <body> <form> <input type="button" value="Display alert box in 3 seconds" onClick="timeMsg()" /> </form> </body> </html> The issue is that just displayes an alert box - I would prefer a link to be displayed instead. Please guys your ideas, scripts or suggestion are more than welcome. Thanks Link to comment https://forums.phpfreaks.com/topic/236107-a-countdown-or-timing-event-system/ Share on other sites More sharing options...
BluB Posted May 11, 2011 Share Posted May 11, 2011 <html> <head> <script type="text/javascript"> function timeMsg() { var t=setTimeout("alertMsg()",3000); } function alertMsg() { var elem = document.getElementById("link"); elem.innerHTML = "<a href=\"#\">Link</a>"; } </script> </head> <body> <form> <input type="button" value="Display alert box in 3 seconds" onClick="timeMsg()" /> </form> <p id="link">A link will appear here!</p> </body> </html> That should help you make it do what you want it to do. You can change the # in "<a href=\"#\">Link</a>" to whatever link you want it to be. Optionally you can use another element like <span> if you want the link to appear somewhere else or in a block of text. Link to comment https://forums.phpfreaks.com/topic/236107-a-countdown-or-timing-event-system/#findComment-1213945 Share on other sites More sharing options...
kamal213 Posted May 12, 2011 Author Share Posted May 12, 2011 Hi BluB, What can I say, Your a genius and you were born that way!! Thanks buddy that was precisely wat I need - works perfectly. Thanks once again Link to comment https://forums.phpfreaks.com/topic/236107-a-countdown-or-timing-event-system/#findComment-1214412 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.