Solved

aspx timer easy question

Posted on 2002-04-23
4
714 Views
Last Modified: 2008-03-10
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
Comment
Question by:Yakeni
4 Comments
 
LVL 23

Expert Comment

by:naveenkohli
ID: 6964612
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
 
LVL 1

Expert Comment

by:HenningF
ID: 6965233
How about making an animated gif that is displayed in three seconds and then becomes transparent?

HenningF
0
 
LVL 4

Accepted Solution

by:
DJDoug earned 50 total points
ID: 6969510
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
 

Author Comment

by:Yakeni
ID: 6970296
cheers buddy
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
classic asp checkbox uncheck and check 2 62
Copy only dates 3 89
ASP.net VB.net gather value of text box text change 4 51
Voice recognition ASP or ASP.NET or JavaScript 2 69
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question