Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Old 07-28-2009, 02:17 AM waiting
Experienced Talker

Posts: 41
Trades: 0
how can i get this to work
Code:
<html>
<head>
<script type="text/javascript">
function timedMsg()
{
var t=setTimeout("document.getElementById("b1").src = "/tiles/1.bmp")",500);
}
</script>
</head>
<body onload="timedMsg()"/>
what im trying to do is add a wait before changing a image,
(done a few times to create a drifting across the page look)

this is the prototype however ill further try to make it change other stuff about the image if this is not possible then i'd like to know a way to show/hide images with a wait inbetween them

Last edited by flatrat; 07-28-2009 at 02:20 AM..
flatrat is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-28-2009, 10:45 AM Re: waiting
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
setTimout needs a function as its parameter, even if it is an anonymous one. And you don't need to assign its value to a variable unless you intend to clear it(cancel it before the timer stops):
Code:
function timedMsg() {
     setTimout(function() {
          document.getElementById("b1").src = "/tiles/1.bmp";
     }, 500);
}
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 07-28-2009, 11:04 AM Re: waiting
Experienced Talker

Posts: 41
Trades: 0
thanks

Last edited by flatrat; 07-28-2009 at 11:12 AM..
flatrat is offline
Reply With Quote
View Public Profile
 
Old 07-28-2009, 05:28 PM Re: waiting
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
You're welcome
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 07-31-2009, 02:34 PM Re: waiting
Experienced Talker

Posts: 41
Trades: 0
why doesnt the settimeout trigger function3(), function2() is ran from a onclick event,

Code:
 function function2() {
var x1=myX.innerHTML;
var y1=myY.innerHTML;
moveObjTo('rest',x1 -10 ,y1 -10);return false;
setTimeout("function3()", 500);
}
function function3() {
var x1=myX.innerHTML;
var y1=myY.innerHTML;
moveObjTo('rest',x1 -50 ,y1 -50);return false;
}
flatrat is offline
Reply With Quote
View Public Profile
 
Old 07-31-2009, 02:46 PM Re: waiting
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Quote:
setTimeout("function3()", 500);
function3() should not be in quotes:
Code:
setTimeout(function3(), 500);
***EDIT***
oh, and you're returning false before the setTimeOut even executes. Any return statement will exit the function.
__________________
Join me on
Please login or register to view this content. Registration is FREE

Last edited by wayfarer07; 07-31-2009 at 02:48 PM..
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to waiting
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.16676 seconds with 12 queries