Menu in cool iris..

Status
Niet open voor verdere reacties.

thommy86

Gebruiker
Lid geworden
7 apr 2009
Berichten
41
Hallo,

Ik ben bezig om een menu te maken voor een cooliris wall.. ik wil verschillende feeds aan kunnen geven, om zo het album in te delen.

ik heb nu een pulldown menu om verschillen feeds te kiezen. maar ik krijg het niet werkend. de feeds komen wel van een andere site van me af.

volgens mij gaat het ergens fout in het javascript. ik ben nog lerende met javascript.

test pagina

HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
var cooliris = { onEmbedInitialized : function() {} };

function buildArray()
{
var a=buildArray.arguments;
for (var i=0; i<a.length; i++) { this[i]=a[i]; }
this.length=a.length;
}

var urls=new buildArray( "",
"api://media_all.xml",
"api://media_people.xml",
"api://media_land.xml",
"api://media_sports.xml",



function replaceSwfWithEmptyDiv(targetID)
{
var el = document.getElementById(targetID);
if(el){ el.innerHTML='<div id="wall_loc">';}
}

function go(which)
{
if (which=="new") {var n=2;} <!-- The value of n here sets the starting feed that is selected when the page is loaded. -->
else {var n=which.selectedIndex;}
if (n!=0)
{
replaceSwfWithEmptyDiv("wall_box");
var rows="0";
var url=eval("urls"+"[n]")
<!-- Use the following if/else if statements to set the number of rows for each feed -->
if (n==1) {rows="3"}
else if (n==2) {rows="5"}
else if (n==3) {rows="1"}
else if (n==4) {rows="4"}
var buildFlashVars = eval ("'"+url+"&numRows="+rows+" <!-- Enter your static flashVars here. --> ")
var flashvars={ feed: buildFlashVars };
var params={ allowFullScreen: "true", allowscriptaccess: "always" };
swfobject.embedSWF("http://apps.cooliris.com/embed/cooliris.swf", "wall_loc", "850", "500", "9.0.0", "", flashvars, params);
}
}
</script>
</head>

<body>
<body onload="go('new');">

<form name="form1">
<select name="ddmenu1" onchange="go(this)">
<option> - Select a Feed -
<option> All </option>
<option> People </option>
<option> Land </option>
<option> Sports </option>
</select>
</form>
<div id="wall_box"> <div id="wall_loc"> 
<img style="visibility:hidden;width:0px;height:0px;" border=0 width=0 height=0 src="http://c.gigcount.com/wildfire/IMP/CXNID=2000002.11NXC/bT*xJmx*PTEzMDY*NDE4MDIyNjMmcHQ9MTMwNjQ*MTgwNTUwNiZwPTkwMjA1MSZkPSZnPTEmb2Y9MA==.gif" /><object id="ci_18749_o" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="935" height="600"><param name="movie" value="http://apps.cooliris.com/embed/cooliris.swf"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><param name="bgColor" value="#121212" /><param name="flashvars" value="numrows=3&backgroundcolor=%23000000&style=dark&glowcolor=%23FFFFFF" /><param name="wmode" value="opaque" /><embed id="ci_18749_e" type="application/x-shockwave-flash" src="http://apps.cooliris.com/embed/cooliris.swf" width="935" height="600" allowFullScreen="true" allowScriptAccess="always" bgColor="#121212" flashvars="numrows=3&backgroundcolor=%23000000&style=dark&glowcolor=%23FFFFFF" wmode="opaque"></embed></object>
</div> </div>
</body>
</html>
 
Ik heb je code opgeschoond zodat het het doet, maar je var urls bevat geen geldige URLs.
Ik heb nog nooit van een eval('api://something.xml') gehoord die echte informatie returned, volgens mij slaat dat nergens op, sorry..

Geef me eens absolute http:// urls voor die var urls, al is het er maar 1, dan kan ik je waarschijnlijk wel verder helpen..

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="code/libraries/swfobject/swfobject.js"></script>
<script type="text/javascript"><!--
var cooliris = { onEmbedInitialized : function() {} };
 
function buildArray()
{
var a=buildArray.arguments;
for (var i=0; i<a.length; i++) { this[i]=a[i]; }
this.length=a.length;
}
 
var urls=new buildArray( "",
"api://media_all.xml",
"api://media_people.xml",
"api://media_land.xml",
"api://media_sports.xml"
 );
 
 
function replaceSwfWithEmptyDiv(targetID)
{
var el = document.getElementById(targetID);
if(el){ el.innerHTML='<div id="wall_loc">';}
}
 
function go (which) {
	if (which=="new") {var n=2;} //The value of n here sets the starting feed that is selected when the page is loaded. 
	else {var n=which.selectedIndex;};
	if (n!=0)
	{
		replaceSwfWithEmptyDiv("wall_box");
		var rows="0";
		var url=eval("urls"+"[n]")
		// Use the following if/else if statements to set the number of rows for each feed 
		if (n==1) {rows="3"}
		else if (n==2) {rows="5"}
		else if (n==3) {rows="1"}
		else if (n==4) {rows="4"}
		var buildFlashVars = eval ("'"+url+"&numRows="+rows+"'");
		var flashvars={ feed: buildFlashVars };
		var params={ allowFullScreen: "true", allowscriptaccess: "always" };
		swfobject.embedSWF("http://apps.cooliris.com/embed/cooliris.swf", "wall_loc", "850", "500", "9.0.0", "", flashvars, params);
	}
}
</script>
</head>
 
<body>
<body onload="go('new');">
 
<form name="form1">
<select name="ddmenu1" onchange="go(this)">
<option> - Select a Feed -
<option> All </option>
<option> People </option>
<option> Land </option>
<option> Sports </option>
</select>
</form>
<div id="wall_box"> <div id="wall_loc"> 
<img style="visibility:hidden;width:0px;height:0px;" border=0 width=0 height=0 src="http://c.gigcount.com/wildfire/IMP/CXNID=2000002.11NXC/bT*xJmx*PTEzMDY*NDE4MDIyNjMmcHQ9MTMwNjQ*MTgwNTUwNiZwPTkwMjA1MSZkPSZnPTEmb2Y9MA==.gif" /><object id="ci_18749_o" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="935" height="600"><param name="movie" value="http://apps.cooliris.com/embed/cooliris.swf"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><param name="bgColor" value="#121212" /><param name="flashvars" value="numrows=3&backgroundcolor=%23000000&style=dark&glowcolor=%23FFFFFF" /><param name="wmode" value="opaque" /><embed id="ci_18749_e" type="application/x-shockwave-flash" src="http://apps.cooliris.com/embed/cooliris.swf" width="935" height="600" allowFullScreen="true" allowScriptAccess="always" bgColor="#121212" flashvars="numrows=3&backgroundcolor=%23000000&style=dark&glowcolor=%23FFFFFF" wmode="opaque"></embed></object>
</div> </div>
</body>
</html>
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan