By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,930 Members | 1,350 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,930 IT Pros & Developers. It's quick & easy.

need help with onClick to function.

P: n/a
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=fals e\">";
strString += "<embed src=\"FLVPlayer_Progressive.swf\"
flashvars=\"&MM_ComponentVersion=1&skinName=Halo_S kin_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=isFlashon 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

Nov 15 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

donradii wrote:
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=fals e\">";
strString += "<embed src=\"FLVPlayer_Progressive.swf\"
flashvars=\"&MM_ComponentVersion=1&skinName=Halo_S kin_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=isFlashon 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.
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
Nov 15 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.