I have a simple javascript overlay (like a lightbox) with a message that pops up. The user is meant to click a button, see the overlay thanking them for their vote, and then be redirected to the affiliate page (its a poll site) after about 3 seconds. I have everything down, except, it will either display the overlay as one of the onClick events, or it will do the timedRedirect but not both. I've tried putting the redirect before and after, and when its before it redirects, when its after, it shows the overlay. How can I do a timed redirect and show this message? <script type="text/JavaScript"> <!-- redirectTime = "3500"; redirectURL = "http://x.azjmp.com/2KTCs"; function timedRedirect() { setTimeout("location.href = redirectURL;",redirectTime); } // --> </script> <a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'"; "timedRedirect()"; > <img class="alignleft" title="no" src="http://www.pollquick.net/no.jpg" alt="" width="260" height="74" /></a><div id="light" class="white_content" >Thank you for your input! Follow the directions on the next page to submit your vote. <a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">.</a></div> <div id="fade" class="black_overlay"></div> </div> Code (markup):
<script type="text/JavaScript"> <!-- redirectTime = "3500"; redirectURL = "http://x.azjmp.com/2KTCs"; function timedRedirect() { setTimeout("location.href = redirectURL;",redirectTime); } // --> </script> <a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'; timedRedirect()"; > <img class="alignleft" title="no" src="http://www.pollquick.net/no.jpg" alt="" width="260" height="74" /></a><div id="light" class="white_content" >Thank you for your input! Follow the directions on the next page to submit your vote. <a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">.</a></div> <div id="fade" class="black_overlay"></div> </div> Code (markup): you can't close the onclick quotation mark and reopen it..