Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passint a cookie into flash - whats wrong with my code??

Status
Not open for further replies.

dru312

Programmer
Nov 20, 2002
11
0
0
US
<HTML>
<HEAD><TITLE>Example</TITLE>
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!--
// a simple function that returns the value of a cookie
function getCookie(name)
{
if (document.cookie)
{
var cookies=document.cookie.split(&quot;;&quot;);
for (var i=0; i<cookies.length; i++)
{
var varName=(cookies.split(&quot;=&quot;)[0]);
var varValue=(cookies.split(&quot;=&quot;)[1]);

// the next 2 lines trim whitespaces (Netscape 7 problem)
while (varName.charAt(0)==&quot; &quot;)
varName=varName.substr(1,varName.length);
if (varName==name)
return varValue;
}
}
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!--
document.write(
'<OBJECT classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot; codebase=&quot;'ID=flaMovie WIDTH=100% HEIGHT=100%> <PARAM NAME=flaMovie value=&quot;quizComponent.swf&quot;?userName=' + getCookie('userName')&quot;>\n'+
'<PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#999999>\n'+
'<EMBED src=&quot;quizComponent.swf&quot;?userName=' + getCookie('userName') quality=high bgcolor=#999999 WIDTH=100% HEIGHT=100% TYPE=&quot;application/x-shockwave-flash&quot;>\n'+
' </EMBED>\n'+
'</OBJECT>\n');
//-->
</SCRIPT>
</BODY>
</HTML>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top