View Full Version : Help with Images
Dinold
03-05-2007, 02:20 PM
I need to code that allows my to view an image for certain time and then hide it or disappear it please help me !!!!
hey,
you shold use javascript timeout here is an example :
<script type="text/javascript">
<!--
function timingex( ){
setTimeout("alert('Three seconds has passed.');",3000);
}
// -->
</script>
<form>
<input type="button" VALUE="Click me!" OnClick="timingex( )">
</form>
Hope it's was helfull !!!:D
Dinold
03-05-2007, 03:36 PM
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<script type="text/javascript">
<!--
function timingex( ){
setTimeout("alert('Three seconds has passed.');",10000);
}
// -->
</script>
<form>
<input type="button" VALUE="Click me!" OnClick="timingex( )">
</form>
</body>
</html>
I need an Image not a botton could you code with an image
thetestingsite
03-05-2007, 03:42 PM
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<script type="text/javascript">
<!--
function hideImg(){
setTimeout("alert('Three seconds has passed.');",3000);
document.getElementById('hideImg').style.visibility = 'none';
}
// -->
</script>
</head>
<body>
<div id="hideImg">
<img src="test.gif" onload="hideImg();">
</div>
</body>
</html>
Change the part in red above to the image you want. Not tested, but should work. Hope this helps.
Dinold
03-05-2007, 03:47 PM
Instead of making an botton saying 3 seconds passed is it possible to hide it or make it disapper image
thetestingsite
03-05-2007, 03:51 PM
Ok, try this:
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<script type="text/javascript">
<!--
function hideImg(){
setTimeout('dohide()',3000);
}
function dohide() {
document.getElementById('hideImg').style.visibility = 'hidden';
}
// -->
</script>
</head>
<body>
<div id="hideImg">
<img src="test.gif" onload="hideImg();">
</div>
</body>
</html>
Again, not tested.
Dinold
03-05-2007, 03:56 PM
Is not working but I think your close
the image does not disappear
thetestingsite
03-05-2007, 03:59 PM
Editted (spelling?) the code once again. One little mistake that I found with the visibility. Notice the part in blue in the second code snippet above.
Hope this helps.
Dinold
03-05-2007, 04:01 PM
thanks alot man great job
Thanks thanks thanks !!!! it works perfectly thanks alot
Dinold
03-05-2007, 04:04 PM
Do you know how to use this same technique for an video
Like a video playing for certain time and then be hidden is it possible
TheBigT
03-07-2007, 12:02 AM
Replace: <img src="test.gif" onload="hideImg();">
With: the code to your video and make sure to include onload="hideImg(); within the tag
mburt
03-07-2007, 12:13 AM
onload is not a valid event handler for the <img> tag:
Try this:
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<script type="text/javascript">
function hideImg(){
setTimeout(function() {
document.getElementById('hideImg').style.display = 'none';
},3000);
}
window.onload = hideImg;
</script>
</head>
<body>
<div id="hideImg">
<img src="test.gif">
</div>
</body>
</html>
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.