Jump to content

Jacascript close link?


Bartman

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? :(

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.