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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getTimezoneOffset issue

Status
Not open for further replies.

deluxmilkman

Programmer
Sep 26, 2007
17
JP
i wrote this to change my embedded swf depending on the location,
but it's not working.
it also disable other javascript on the page.

HTML:
myDate = new Date();
myTD = myDate.getTimezoneOffset();
if ((myTD >= 180) && (myTD < 480)){
document.mySWF.src="alaska.swf";
}else if((myTD >=1 80) && (myTD < 180)){
document.mySWF.src="england.swf";
}else if((myTD >= -540) && (myTD < -180)){
document.mySWF.src="japan.swf";
}else{
document.mySWF.src="hawai.swf";
}

thanx for your help.
 
Code:
myDate = new Date();
myTD = myDate.getTimezoneOffset();
if ((myTD >= 180) && (myTD < 480)){
document.mySWF.src="alaska.swf";
}else if((myTD >=[COLOR=red]180[/color]) && (myTD < 180)){
document.mySWF.src="england.swf";
}else if((myTD >= -540) && (myTD < -180)){
document.mySWF.src="japan.swf";
}else{
document.mySWF.src="hawai.swf";
}
 
thanks. now other scripts work,
but it doesn't change mySWF.

HTML:
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="[URL unfurl="true"]http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"[/URL] width="105" height="105  ">
    <PARAM name="quality" value="high">
    <EMBED src="'alaska.swf'" name="mySWF" enablejavascript="true" quality="high" pluginspage="[URL unfurl="true"]http://www.macromedia.com/go/getflashplayer"[/URL] type="application/x-shockwave-flash" width="105" height="105"></EMBED></OBJECT>
 
I don't know exactly how the embed tag works. You could try dom setAttribute method and assign an id to your tag and then get the tag using getElementById(id).setAttribute(urattrib,"blah"). I think though it would be easier to have a div and set its innerHTML property to a different obj/embed string for each time zone. I recall that is how the swobject javascript sort of worked. It used to be a decent way of embeding flash movies. You can even have a the div populated with a gif or something for none flash users and write over it if javascript and flash are enabled.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top