/    Sign up×
Community /Pin to ProfileBookmark

Javascript Broswer Compatibility Issues

Greetings! After countless hours scouring the net and carton of smokes later I have come to my whit’s end and request any assistance that might be given in helping solve my problem.

I have a set of frames, the one named bottom is a 1px place holder for a mp3 player. The one named top is the main site with a different flash banner allowing the user to change songs in the flash mp3 player (yea, it sounds complex and it is)

The script works great under Internet Explorer 7, does everything it needs to do, HOWEVER firefox calls the javascript function fine, but does not proceed to change the song. This has to be a browser compatibility issues as I have tracked down all other variables.

Please visit the site here [url]www.tailgateville.com[/url] and take a look at the source below.

Thanks for any ideas you may have in helping me correct this.

frames page code

[CODE]<html><head>
<title>Welcome</title>
</head>
<body>
<frameset border=”0″ cols=”1,*” frameborder=”0″ framespacing=”0″>

<frame id=”bottom” name=”bottom” scrolling=”no” src=”music.html”>
<frame id=”top” name=”top” scrolling=”auto” src=”index2.html”>
<noframes> <p>This page uses frames</p></noframes>
</body>

</frameset>
</html>[/CODE]

index2.html (Frame id=top) Snipps from code
header code ? [COLOR=”Red”][B][U]NOW THIS IS TRIPPY. FIREFOX RUNS THE 1ST ALERT WITHIN THE SCRIPT, BUT NOT THE SECOND AND IT DOES NOT CHANGE THE SONG[/U][/B][/COLOR]

[CODE]<script type=”text/javascript” language=”javascript”>
var browser=navigator.appName;
function next()
{alert(‘next’); parent.bottom.window.music.tgotolabel(“_level0.control/”,”nextsong”); alert(‘over’);}
</script>[/CODE]

flash banner placement code

[CODE]<script type=”text/javascript”>
if (browser != “Netscape”){
document.write(‘<object data=”splash_banner.swf” swLiveConnect=”true” height=”240″ style=”background-color: transparent” type=”application/x-shockwave-flash” width=”1024″>’);
document.write(‘<param name=”movie” value=”splash_banner.swf” />’);
document.write(‘<param name=”quality” value=”High” />’);
document.write(‘<param name=”wmode” value=”transparent” />’);
document.write(‘</object>’);
}else{
document.write(‘<object classid=”clsid:d27cdb6e-ae6d-11cf-96b8-444553540000″ codebase=”http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0″ width=”1024″ height=”240″ id=”flashObject”>’);
document.write(‘<param name=”allowScriptAccess” value=”sameDomain” />’);
document.write(‘<param name=”movie” value=”splash_banner.swf” />’);
document.write(‘<param name=”quality” value=”best” />’);
document.write(‘<param name=”bgcolor” value=”#ffffff” />’);
document.write(‘<param name=”menu” value=”false” />’);
document.write(‘<param name=”swliveconnect” value=”true”>’);
document.write(‘<embed src=”splash_banner.swf” quality=”high” bgcolor=”#ffffff” menu=”false” width=”1024″ height=”240″ name=”flashObject” allowScriptAccess=”sameDomain” type=”application/x-shockwave-flash” pluginspage=”http://www.macromedia.com/go/getflashplayer” />’);
document.write(‘</object>’);
}
</script>[/CODE]

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@ZeroKilledMar 23.2009 — [colorcode=javascript]function next() {

alert("next");

parent.bottom.window.[B]music[/B].tgotolabel("_level0.control/", "nextsong");

alert("over");

}

[/colorcode]

here is your function [B]next[/B], notice the bold [B]music[/B]. in firefox, such object is undefined because [b]music[/b] is intended to be the ID of an element, in this case an <object> element. that is the wrong way to refer to an element by it's ID, you should use the standard code [B]getElementById[/B]. try the followig:

[colorcode=javascript]

function next() {

alert("next");

parent.bottom.document.getElementById('music').tgotolabel("_level0.control/", "nextsong");

alert("over");

}[/colorcode]
Copy linkTweet thisAlerts:
@sharp_macauthorMar 23.2009 — Zero, thanks for your reply. I tested out the code and that works just fine in IE again, but firefox is still not getting through to the second alert.... it's like it gets hung up and never completes the "over" alert.

A very neat and tidy code tho, that will be the base for the other functions, but we still have to get firefox inline.... any other ideas?

By the way this is the code embeding the music player....

&lt;object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0" id=music width=480 height=216&gt;
&lt;param name=movie value="music.swf"&gt;
&lt;param name=quality value=high&gt;
&lt;param name=bgcolor value=#cccccc&gt;
&lt;embed src="music.swf" quality=high bgcolor=#cccccc swliveconnect=true name=music width=480 height=216 type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash"&gt;&lt;/embed&gt;
&lt;/object&gt;
Copy linkTweet thisAlerts:
@ZeroKilledMar 23.2009 — wow! this is the very first time i manage to use javascript and flash movie. i has never used javascript to access a flash movie. i was thinking there should be an interface that flash movie provide for outer scripting, and i was right. so, it came to be that, despite you are using the correct method, it is in the wrong case. the method [B]tgotolabel[/B] doesn't work in firefox because it is case-sensitive. so, it should be TGotoLabel. in the following link you will find the standard interface along with their correct case: http://www.adobe.com/support/flash/publishexport/scriptingwithflash/scriptingwithflash_03.html

also, change your line back to your previous version. in this particular case is necessary because the EMBED element is the one displaying the flash movie, not the OBJECT element.

[colorcode=javascript]

parent.bottom.document.music.TGotoLabel("_level0.control/", "nextsong");

[/colorcode]

the same basis apply to the rest of your button, previous and pause.
Copy linkTweet thisAlerts:
@sharp_macauthorMar 24.2009 — ha! crazyness..... i use notepad++ to change my case in scripts to lower case and never even thought about the trouble between browsers being a case issue!

Wow thank you for your time and work in helping me look over my scripting if you would like me to post my FLA files so you can extract & play with the movie's code I will do so, thank you again for your work! you rock!
×

Success!

Help @sharp_mac spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...