Hello all;
I have a web page that displays a blank gif for about 2 seconds, then
displays an animated gif image, then, after the animation plays, I want to
display a link so the user can click on it and go to another page. I am
fairly new to javascript and came up with the following code:
-----------------------
<p align="center"><img src="images/nil.gif" align="middle" width="375"
height="300" name="blank_image"></p>
<script language="javascript">
function create_link() {
// document.write('<p align="center"><a href="index2.htm">ENTER</a></p>');
document.write('<p align="center"><a href="index2.htm">ENTER</' +
'a></p>');
}
</script>
<script language="javascript">
ccs_img = new Image(76, 21);
ccs_img.src = "images/ccs_logo_animated_rotate.gif";
setTimeout("document['blank_image'].src = ccs_img.src", 2000);
setTimeout("create_link()", 7100);
</script>
-----------------------
The problem is that when the "create_link" script executes it replaces the
existing image and only the link appears (I would like the link to appear
centered under the image). I've searched google for more info and have been
experimenting with document.write and setTimeout. I am confused by the
results I get. Hopefully someone can explain what's happening and why, or
what I am doing incorrectly.
If I put the following in a page:
<script>
document.write("123");
document.write("456");
</script>
I get: 123456 -- the output from both document.write commands is displayed.
If I put the following in a page:
<script>
document.write("123");
document.write("456");
setTimeout('document.write("ABC")', 1000);
</script>
I get: 123456, then after 1 second this is replaced by ABC -- I would expect
123456ABC
If I put the following in a page:
<script>
setTimeout('document.write("ABC")', 1000);
setTimeout('document.write("456")', 2000);
</script>
I get: ABC and the 456 never appears!!
I am confused!!
As I am still in the initial learning curve for javascript, I'm not sure
what to look for or where to look.
1) Can I do what I want but just don't know how?
2) Is there a way to put the link on the page via HTML and keep it
disabled/invisible until the animation plays?
3) Does anyone have any other ideas?
TIA.
Charles...
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/04