Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java Script HELP! - settimeout function

807588May 29 2009 — edited May 29 2009
if any can help me, pls..... going mad :)

im writing a code for a single button which will on click swap image (animated .gif) and wait 1.5sec then execute a link (to next following page)
but i cant seem to get the timer function/execute next link to work...
i am beginner at java :)

Can anyone help me with whats missing ?

code is as following :
------------------------------------------------------------------------------------------------

<html>
<head>

<script language=JavaScript>

intImage = 2;
function swapImage()
{
switch (intImage)
{
case 1:
button.src = "button.gif"
intImage = 2
return(false);
case 2:
button.src = "button-a.gif"
intImage = 2
return(false);
}
}

function timer()
{
setTimeout( SOMETHING MISSING HERE ), 1500);
}
</script>
</head>

<body onload="preload('button-a.gif', 'button.gif')" bgcolor="Black">
<table border="0" height="100%" width="100%" cellspacing="0" cellpadding="20" bordercolor="#000000">
<tbody>
<tr>
<td valign="middle" align="center">
<table width="451" background="background.gif" border="0" cellpadding="0" cellspacing="0" height="500">
<tbody>
<tr>
<td height="75" nowrap="nowrap">
&nbsp;
</td>
</tr>
<tr>
<td valign="top" width="100%" align="center" height="100%">
<img id="button" name="button" src="button.gif" onclick="swapImage();timer()">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</body>

</html>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 26 2009
Added on May 29 2009
18 comments
395 views