Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 722
  • Last Modified:

aspx timer easy question

In "VB language" using aspx... Basically i want and image to appear for 3 seconds and then disappear.. This timer can be set off by a button to make the image appear and then disappear after 3 seconds..

Cheers Yakeni
0
Yakeni
Asked:
Yakeni
1 Solution
 
naveenkohliCommented:
You will have to do it from client side script. It has nothing to do with server side code. You can make use of RegusterClientScriptBlock to emit client side script from server side code.
0
 
HenningFCommented:
How about making an animated gif that is displayed in three seconds and then becomes transparent?

HenningF
0
 
DJDougCommented:
Hi.  Create a transparent image of the same size as the image you want to display.  Then the following code will do exactly what you want.  (Note:  You can do this from server side using Response.Write's, but it will generate the exact same thing, and end users will still see your code.  Is there any reason why you want to do it from server side code?)

<%@ Language=VBScript %>
<HTML>
<HEAD>
<SCRIPT language=javascript>
// Create image objects to cache the image versus constant
// switching from source to source.

// Create your image object.
var myImage = new Image();

// Your transparent image object.
var myImageTransparent = new Image();

// Set the sources of your images.
myImage.src = "images/Greeting.gif";
myImageTransparent.src = "images/Transparent.gif";
</SCRIPT>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function cmdShowImage_onclick() {
// Show the image.
imageOnPage.src = myImage.src;
// Time out 3 seconds, then show transparent image.
setTimeout("imageOnPage.src = myImageTransparent.src;", 3000);
}


function window_onload() {
// Set the initial image to transparent.
imageOnPage.src = myImageTransparent.src;
}

//-->
</SCRIPT>
</HEAD>
<BODY LANGUAGE=javascript onload="return window_onload()">

<P><IMG alt="" id="imageOnPage" name="imageOnPage"></P>
<P><INPUT id=cmdShowImage type=button value="Show Image" name=cmdShowImage LANGUAGE=javascript onclick="return cmdShowImage_onclick()"></P>

</BODY>
</HTML>

Hope this helps.
Cheers to you to!
0
 
YakeniAuthor Commented:
cheers buddy
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now