It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

change embed src using

change embed src using

Postby deluxmilkman on Fri Sep 28, 2007 7:48 pm

I'm trying to change embed src using document.getElementById.
what am i missing?

[HTML]

<script language="JavaScript" type="text/JavaScript">

myDate = new Date();
myTD = myDate.getTimezoneOffset();
alert(myTD);
if ((myTD >= 180) && (myTD < 480)){
document.getElementById('localswf').setAttribute('src','one.swf');
}else if((myTD >=180) && (myTD < 180)){
document.getElementById('localswf').setAttribute('src','two.swf');
}else if((myTD >= -540) && (myTD < -180)){
document.getElementById('localswf').setAttribute('src','three.swf');

}else{
document.getElementById('localswf').setAttribute('src','four.swf');
}

</script>



</head>
<body>
<div>
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="105" height="105 ">
<EMBED src='one.swf' name="localswf" id="localswf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="105" height="105"></EMBED></OBJECT>
</div>

</body>
[/HTML]


thanx
deluxmilkman
 
Posts: 8
Joined: Wed Sep 26, 2007 3:15 pm

Re: change embed src using

Postby Logician on Sun Sep 30, 2007 11:47 pm

deluxmilkman wrote:I'm trying to change embed src using document.getElementById.
what am i missing?
Your script runs before the <embed> is rendered.
Logician
 
Posts: 20
Joined: Tue Jun 12, 2007 3:43 am
Location: U.K.

Postby dafunkymunky on Sat Oct 06, 2007 7:41 am

just use document.getElementById('localswf').scr=url('the source goeshere')
--------DAFUNKYMUNKY--------
::THE::NECESSARY::[D]EVIL::
....errr i mean munky....
User avatar
dafunkymunky
100+ Club
 
Posts: 183
Joined: Fri Apr 08, 2005 7:32 am
Location: India


Who is online

Users browsing this forum: No registered users and 5 guests