Jump to content

Will this work?


phate
 Share

Recommended Posts

I want to create an animation and have just read a bit on javascript and came up with this. I don't have the jpg files yet so haven't been able to test it. Does it look like it would work? I want each jpg to play for 1 second then go onto the next one and when the last jpg is shown I want it to start again by showing the first jpg. I'll have lots of jpgs but have only shown it with 3 here.I know I don't really need the array but i've put it in anyway.<head><script type="text/javascript">function functionname()silk = 1pic = new Array ("name1.jpg","name2.jpg","name3.jpg")a = setTimeout ("document.sw.src = "pic[0]"",1000)b = setTimeout ("document.sw.src = "pic[1]"",1000)c = setTimeout ("document.sw.src = "pic[2]"",1000)while (silk=1){abc}</script></head><body><img src="name1.jpg" name="sw" onload=functionname()/></body>

Link to comment
Share on other sites

I think I can't use the Onload event in an image tag. If that's the case could I just put this in the body?<script type="text/javascript">silk = 1pic = new Array ("name1.jpg","name2.jpg","name3.jpg")a = setTimeout ("document.sw.src = "pic[0]"",1000)b = setTimeout ("document.sw.src = "pic[1]"",1000)c = setTimeout ("document.sw.src = "pic[2]"",1000)while (silk=1){abc}</script>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...