muek
09-22-2003, 01:58 PM
Hi,
I'm try to make that when my page is load a random image appear, called screen1.jpg or screen2.jpg.
I try to make this by changing "scr=" but doesn't work
Can someone give me a hand??
Thanks in advance.
Here my code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
function test2()
{
var MAX = 2;
var index = Math.floor( Math.random()*MAX )+1;
var texto = "imagens/screen" + index + ".jpg";
document.write(texto);
return texto;
}
</script>
<body >
<img src="test2();" width="25%" height="25%">
</body>
</html>
I'm try to make that when my page is load a random image appear, called screen1.jpg or screen2.jpg.
I try to make this by changing "scr=" but doesn't work
Can someone give me a hand??
Thanks in advance.
Here my code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
function test2()
{
var MAX = 2;
var index = Math.floor( Math.random()*MAX )+1;
var texto = "imagens/screen" + index + ".jpg";
document.write(texto);
return texto;
}
</script>
<body >
<img src="test2();" width="25%" height="25%">
</body>
</html>