Jump to content

Recommended Posts

Can someone tell me how to make a close button for this?  The close button I currently have here makes the IMAGE2 disappear but I cannot see IMAGE1 until the time runs out on the setTmeout.  I want to be able to click the closeX  and close out the whole script leaving IMAGE1 showing. Here is what I have:

 

            <table border="0" width="650" id="table1" cellspacing="0" cellpadding="0" bgcolor="#000000" height="350">
<tr>
	<td align="center">
<script type="text/javascript"> 
window.onload = function () { 
setTimeout(function () { 
var div = document.getElementById('hideOverlay'); 
div.innerHTML = '[b]IMAGE1 GOES HERE[/b]';  }, 6000);} 
</script>
<div id="hideOverlay">
<table border="0" width="650" id="table1" cellspacing="0" cellpadding="0" height="350">
<tr>
	<td align="center" width="650" height="350"><a style="text-decoration: none" href="javascript:void(0)" onclick="var lyr =document.getElementById('hideOverlay'); lyr.innerHTML='';"/><font color="#666666" size="2">Close [x]</font></a>[b]IMAGE2 GOES HERE[/b]</td>
		</tr>
	</table></div>
	</td>
</tr>
</table>
</div>

Link to comment
https://forums.phpfreaks.com/topic/252784-jacascript-close-link/
Share on other sites

Here is what I have if anyone can help me get it working. When I click on the Close [X]  it does nothing. It just waits and after the seconds the IMAGE1 appears and IMAGE2 disappears.

 

<table border="0" width="650" id="table1" cellspacing="0" cellpadding="0" bgcolor="#000000" height="350">
<tr>
	<td align="center">
<script type="text/javascript"> 
window.onload = function () { 
var tim = setTimeout(function () { 
var div = document.getElementById('hideOverlay'); 
div.innerHTML = 'IMAGE1 GOES HERE';  }, 6000);} 
</script>
<div id="hideOverlay">
<table border="0" width="650" id="table1" cellspacing="0" cellpadding="0" height="350">
<tr>
	<td align="center" width="650" height="350"><a style="text-decoration: none" href="javascript:void(0)" onclick="javascript:window.clearTimeout('tim')"/>Close [x]</a><br>IMAGE2 GOES HERE</td>
		</tr>
	</table>
	</td>
</tr>
</table>
</div>

 

Any ideas why it will not work? Anyone? :(

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.