need help with onClick to function.

D

donradii

Hello all, I am new here and am new the world of javascripting. I am
having a heck of a time trying to accomplish something that i
conceptually know what i want to do but can not seem to get it into
code correctly.

What I am looking to do is this.

I have a web page that uses 3 different formats of video. Right now to
load each format I have 3 separate pages. Each format is loaded onto
the page with an embed function.

This is an example of the FLV loading function:

function LoadThisSWF(FLV){
var strString = "<object
classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=";
strString +=
"\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\"
width=\"342\" height=\"291\" title=\"Quickstream.tv\">";
strString += "<param name=\"movie\"
value=\"FLVPlayer_Progressive.swf\">";
strString += "<param name=\"quality\" value=\"high\">";
strString += "<param name=\"FlashVars\"
value=\"&MM_ComponentVersion=1&skinName=Halo_Skin_3&streamName="+FLV+"&autoPlay=true&autoRewind=false\">";
strString += "<embed src=\"FLVPlayer_Progressive.swf\"
flashvars=\"&MM_ComponentVersion=1&skinName=Halo_Skin_3&streamName="+FLV+"&autoPlay=true&autoRewind=false\"
quality=\"high\"
pluginspage=\"http://www.macromedia.com/go/getflashplayer\"
type=\"application/x-shockwave-flash\" width=\"342\"
height=\"291\"></embed>";
strString += "</object>";

document.getElementById('isFlash').innerHTML = strString;
}

I have additional ones that I have customized for quicktime and windows
media.

All of the players load into a <div id=isFlash> on the page.

what I would like to do is be able to, if possible, create a global
variable called loadThisFormat and have that equal the result of a
function that is set when a person clicks on a different format at the
bottom of the page.

so in pseudo code:

var loadThisFormat = result of chooseFormat

function chooseFormat
if onclick = flash then load LoadThisSWF
if onclick = quicktime then load LoadThisMOV
if onclick = windows media then load LoadThisWMV

this way when a person selects a format of video, when they click on
the other videos on the page they will play in their selected format

If anyone can help me i will be forever grateful!!!

Thank you in advance!

Donald
 
T

Tom Cole

donradii said:
Hello all, I am new here and am new the world of javascripting. I am
having a heck of a time trying to accomplish something that i
conceptually know what i want to do but can not seem to get it into
code correctly.

What I am looking to do is this.

I have a web page that uses 3 different formats of video. Right now to
load each format I have 3 separate pages. Each format is loaded onto
the page with an embed function.

This is an example of the FLV loading function:

function LoadThisSWF(FLV){
var strString = "<object
classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=";
strString +=
"\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\"
width=\"342\" height=\"291\" title=\"Quickstream.tv\">";
strString += "<param name=\"movie\"
value=\"FLVPlayer_Progressive.swf\">";
strString += "<param name=\"quality\" value=\"high\">";
strString += "<param name=\"FlashVars\"
value=\"&MM_ComponentVersion=1&skinName=Halo_Skin_3&streamName="+FLV+"&autoPlay=true&autoRewind=false\">";
strString += "<embed src=\"FLVPlayer_Progressive.swf\"
flashvars=\"&MM_ComponentVersion=1&skinName=Halo_Skin_3&streamName="+FLV+"&autoPlay=true&autoRewind=false\"
quality=\"high\"
pluginspage=\"http://www.macromedia.com/go/getflashplayer\"
type=\"application/x-shockwave-flash\" width=\"342\"
height=\"291\"></embed>";
strString += "</object>";

document.getElementById('isFlash').innerHTML = strString;
}

I have additional ones that I have customized for quicktime and windows
media.

All of the players load into a <div id=isFlash> on the page.

what I would like to do is be able to, if possible, create a global
variable called loadThisFormat and have that equal the result of a
function that is set when a person clicks on a different format at the
bottom of the page.

AFAIK there are no global variables that existing across page loads.
There are global variables that exist through an entire single page
load, though.

If you need to keep variables from page to page to page the options I
know of are to set a cookie, OR to use an invisible IFrame and
store/read that value from there.

HTH.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top