/    Sign up×
Community /Pin to ProfileBookmark

paching script label

Hi there, I’m trying to patch script but I don’t know if that could be possible. I explain everything, I got a DHTML menu and behind I got a Flash movie, the problem is only happening in Safari (mac) the dhtml disappear behind the flash, because that’s a apple issue, I made 2 menus, 1 for Safari and other for the rest of the browsers, I got the first javascript that works fine, where I detect the browser:

[COLOR=DarkOliveGreen]<script language=”JavaScript”>
var agt=navigator.userAgent.toLowerCase();
if (agt.indexOf(“safari”) != -1) {
var path = “code_mac/”;
} else {
var path = “code/”;
}
</script> [/COLOR]

And then the Javascript for the menu,

[COLOR=DarkRed]<script language=”JavaScript” vqptag=”datafile” [B][COLOR=Red]src = “code/menu.js”[/COLOR][/B]></script>[/COLOR]

What im trying to change is the src. I got 2 folders called “code” and “code_mac” both got a different menu.

Here are my questions– How can I change the [B]src = “code/menu.js”[/B] for src = [B]“code_mac/menu.js”[/B] when is Safari?, is that possible?

Thanks in advance

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@konithomimoApr 10.2006 — &lt;script type="text/javascript"&gt;
onload = function()
{
var agt=navigator.userAgent.toLowerCase();
if (agt.indexOf("safari") != -1) {
var path = "code_mac/";
} else {
var path = "code/";
}
LoadScript(path+'menu.js');
}

function LoadScript(url)
{
var e = document.createElement("script");
e.src = url;
e.type="text/javascript";
document.getElementsByTagName("head")[0].appendChild(e);
}
&lt;/script&gt;
Copy linkTweet thisAlerts:
@shexpireauthorApr 10.2006 — Thanks mate, sorry about that but, to make a sort message i miss few important thinks, there is my script [URL=http://s128162330.websitehome.co.uk/menus/]http://s128162330.websitehome.co.uk/menus/[/URL]

As every body can see the path is working when I used it in between the <script>

So I still have problems to load this. Sorry but I’m very new in Javascript, I’m coming from action script everything seems easier &#61514;
×

Success!

Help @shexpire 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...