PDA

View Full Version : Resolved GIF or SWF when page loads - Grrrrr :) !!!



suction cup
11-28-2010, 01:45 PM
Hi Folks,

Can anyone please recommend a simple way to load a random image on pageload - from a selection of gifs and swfs?

We currently have a simple array method - works great with gifs, but no swf action so far.

Been playing with a bunch of scripts from the archive here, but no joy, and to be honest I don't understand them enough to say why.

Hoping someone can help get this resolved.

Many Thanks All

suction cup
11-28-2010, 03:57 PM
I know it's not much to you, but it's ACTUALLY WORKING

Here's da code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!-- Created on 28-Nov-2010 14:46:46 -->

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
yaya
</title>
<meta name="GENERATOR" content="Arachnophilia 5.4"/>
<meta name="FORMATTER" content="Arachnophilia 5.4"/>
<script language="JavaScript">

// Generate a Random Number
var randomnumber = Math.round(Math.random()*3);

// Select a swf and execute the corresponding function
if (randomnumber == 1)

{movie1();}

else if (randomnumber == 2)

{movie2();}

else if (randomnumber == 3)

{movie3();}

else {movie4();}

//Functions to write out the correct flash movie resource.

function movie1(){
document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0\" width=\"980\" height=\"285\"><param name=movie value=\"1.swf\"><param name=quality value=high><embed src=\"1.swf\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"980\" height=\"323\"></embed></object>")
}

function movie2(){
document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0\" width=\"980\" height=\"285\"><param name=movie value=\"2.swf\"><param name=quality value=high><embed src=\"2.swf\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"980\" height=\"323\"></embed></object>")
}

function movie3(){
document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0\" width=\"980\" height=\"285\"><param name=movie value=\"3.swf\"><param name=quality value=high><embed src=\"3.swf\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"980\" height=\"323\"></embed></object>")
}

function movie4(){
document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0\" width=\"980\" height=\"285\"><param name=movie value=\"4.swf\"><param name=quality value=high><embed src=\"4.swf\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"980\" height=\"323\"></embed></object>")
}
</script>
</head>

<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">



</body>
</html>

suction cup
11-28-2010, 04:22 PM
OK, it WORKS and is being posted here so no one else has to go through setting this up.

(I know, it's basic - but only if you know HOW)

Random swfs and gifs, voila:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!-- Created on 28-Nov-2010 14:46:46 -->

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
yaya
</title>
<meta name="GENERATOR" content="Arachnophilia 5.4"/>
<meta name="FORMATTER" content="Arachnophilia 5.4"/>
<script language="JavaScript">

// Generate a Random Number
var randomnumber = Math.round(Math.random()*3);

// Select a swf and execute the corresponding function
if (randomnumber == 1)

{movie1();}

else if (randomnumber == 2)

{movie2();}

else if (randomnumber == 3)

{movie3();}

else {movie4();}

//Functions to write out the correct flash movie resource.

function movie1(){
document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0\" width=\"980\" height=\"285\"><param name=movie value=\"1.swf\"><param name=quality value=high><embed src=\"1.swf\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"980\" height=\"323\"></embed></object>")
}

function movie2(){
document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0\" width=\"980\" height=\"285\"><param name=movie value=\"2.swf\"><param name=quality value=high><embed src=\"2.swf\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"980\" height=\"323\"></embed></object>")
}

function movie3(){
document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0\" width=\"980\" height=\"285\"><param name=movie value=\"3.swf\"><param name=quality value=high><embed src=\"3.swf\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"980\" height=\"323\"></embed></object>")
}

function movie4(){
document.write('<img src="1.gif" width="980" height="323" alt="Welcome"/>');

}
</script>
</head>

<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">



</body>
</html>