PDA

View Full Version : Can 1 Script interfere with another?



Sammacha
04-05-2010, 06:37 AM
1) Script Title:
Static logo & Smooth menu

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex4/logo.htm
http://www.dynamicdrive.com/dynamicindex1/ddsmoothmenu.htm

3) Describe problem:

Hi, originally I had both of these scripts working on one page. However to make the menu easy to edit on each page I used the external file and had it fetched with Ajax

Since I have changed this I am unable to get the Static logo to appear on my web page, all I get is the X the link works but the image is not visible

I was wondering if changing the way I used the menu script could interfere with the static logo?

The logo code was untouched

If you want to see the website (or look at the code) where i am trying to use this on it is located here http://www.sammacha.com/Home/index.html

If someone could give me a clue as to what to do to solve the problem i would really appreciate it as I am VERY NEW to this

thank you

djr33
04-06-2010, 03:53 AM
I am not sure about these two specific scripts, but I see that no one has yet replied to this. In general, yes, two scripts can conflict with each other and there are two main reasons (both fixable, though it can be difficult to work through the details sometimes).

1. Naming conflicts-- some variable, function or other entity shares a name between the two scripts and that causes conflicts of reference. It's easy to fix if you can find all of the instances of the name that is the problem. This is by far the most common problem with having two scripts on one page, or at least if you are trying to run two of the same script.

2. Conflict of resources: one script requires a certain setting and the other script requires a different setting, or both scripts must operate within the same area, such as calling both from the body tag's "onload" parameter. It's usually possible to fix this as well with careful reworking and reordering of the conflict aspects but it's much harder to diagnose without a lot of experience. Of course sometimes you'll find it's easy if you experience a javascript error on the page.


The way to test if there is a conflict is to remove both then add one and see if it works; remove it, add the other; finally put them both back. If everything works except when they're together, there's a conflict. But first be sure you aren't missing something like adding some property for BOTH scripts to a certain tag (such as the body tag's onload parameter mentioned above). It is possible you forgot to do the same step for both if you already did it for one (like initiating both onload or setting a CSS class that applies to the elements, etc).

If you find there is a conflict, you can try to troubleshoot by just reordering the scripts (try script A first, then add B, and if that doesn't work try the other order, including the code order-- this can matter in some rare cases, so try having script A actually above script B in the code, then reverse it).

Finally, someone may be able to help you figure out what is wrong, though because of the amount of code going into the two scripts it may take a lot of time/dedication to figure out what is wrong, so it might be hard to find someone who is available and familiar with the scripts. Good luck.

jscheuer1
04-06-2010, 05:35 AM
Your image as configured and highlighted here in the staticlogo.js script:


//** Site Logo/ Watermark Script- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com.
//** Available/ usage terms at http://www.dynamicdrive.com
//** v2.0 (April 19th, 09')


var ddsitelogo={
setting: {orientation:4, visibleduration:0, fadeduration:[1000, 500]}, //orientation=1|2|3|4, duration=millisec or 0, fadedurations=millisecs
offsets: {x:10, y:10},//offset of logo relative to window corner
logoHTML: '<a href="http://www.sammacha.com/" title="Sammacha.com"><img src="http://www.sammacha.com/home/dontlook/Lim-icon.gif" /></a>', //HTML for logo, which is auto wrapped in DIV w/ ID="mysitelogo"

is a 404 not found. As far as I can tell, that's the only problem, at least as regards these two scripts.

Sammacha
04-12-2010, 03:14 AM
Thank you djr33 (Daniel) for your explanation of what I can try to do to solve this issue.
I will definantly look into that and try to figure it out.

and thanks jscheuer1(John)
although I'm not sure if thats the issue here as the logo works perfectly until I use Ajax to fetch the menu form the external file, for some reason after that its an error and no longer able to locate it >.<

I discovered it also interferes with the color selector script :/

jscheuer1
04-12-2010, 03:25 AM
If you doubt it, click on the link:

http://www.sammacha.com/home/dontlook/Lim-icon.gif

It's a 404 not found.

In fact, so is:

http://www.sammacha.com/home/

It should be:


http://www.sammacha.com/Home/

So who knows where the image really is?

Sammacha
04-12-2010, 04:53 AM
O that is very strange, becasue it worked just fine before and it still work here @_@

http://www.sammacha.com/Home/commissions/ColorSelector/index.html

hmm well that did help, thanks so much
just wondering, do you know why it worked before? and why it works on teh above link?
I feel pretty dumb but, o well
and thank you

jscheuer1
04-13-2010, 04:57 AM
They are two different image files in two different locations. So, the one path:


http://www.sammacha.com/gallery/dontlook/Lim-icon.gif

was correct, while the other:


http://www.sammacha.com/Home/dontlook/Lim-icon.gif

needed (at least) to be corrected for upper/lower case agreement.

You would actually be better off, since (unless I missed a subtle difference) it is just the same image anyway, pointing both to the same image. Just use the absolute path.

As to why, I'm not certain. Usually it's because in local testing the upper/lower case of the path and filename almost never matter, and on the web they almost always do.

But there are so many other things that can happen, from simple typos to more complex issues, that it's hard to say with any real certainty.

Sammacha
04-14-2010, 11:51 PM
They are two different image files in two different locations. So, the one path:


You would actually be better off, since (unless I missed a subtle difference) it is just the same image anyway, pointing both to the same image. Just use the absolute path.

no they are the same and thats very true. I have actually been meaning to do that for some time now... thanks for the reminder



As to why, I'm not certain. Usually it's because in local testing the upper/lower case of the path and filename almost never matter, and on the web they almost always do.

But there are so many other things that can happen, from simple typos to more complex issues, that it's hard to say with any real certainty.

It used to work perfectly when it was actually on the web but who knows. Also thanks. I know this takes up your time and this info is very useful to stupid old me who randomly decieded that I could make and run my own website :/

jscheuer1
04-15-2010, 03:25 PM
Well, this is a fairly easy one because I don't have to know the precise answer. I don't think anyone really can, it's something that happened before. So we can't be sure of the original circumstances, only of the current solution.

Remember though I said (emphasis added):


in local testing the upper/lower case of the path and filename almost never matter, and on the web they almost always do.

These things do vary. On the local machine, it depends upon the OS. But most local machines are case insensitive as far as paths and filenames go. On the web it depends upon the server configuration. I have seen at least two servers where the upper and lower case filenames and paths were treated as identical. This led in one case to confusion over the actual names of the files though when tested via javascript as to the href attribute of a given link. Since the web author wasn't constrained by their server to use the correct case, they had a mixture in various places. It all worked for navigation. But in javascript which is case sensitive in most respects, unless steps are taken to make it ignore case, the href was being misinterpreted as not matching, when it really "did" (sort of).

That's not what happened here, but perhaps something similar did. And/or you later changed servers or your server changed its settings as regards case.

Sammacha
04-15-2010, 10:12 PM
well thats good enough of rme
thanks again john

djvk87
06-25-2010, 05:43 AM
How about if you have noticed that 2 scripts are having a conflict (both scripts from DD) but only conflicting in Internet Explorer? Because I am having this problem here (http://wbs.dj-vk.com/yanmar/spareparts.php) between Dynamic Ajax Content (http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm) & Drill Down Menu (v1.6) (http://www.dynamicdrive.com/dynamicindex1/drilldownmenu.htm)

If you visit that page in firefox you will see that when you drill through the menu and click a link it will display dynamic ajax content to the right.

But if you do the same in Internet Explorer no Dynamic Ajax Content will appear and in the bottom left you will get the error ''document.getElementById(...)' is null or not an object'

I can't figure this out no matter how hard I try, I have looked for conflicting variables and resources and can't find what is doing it.
What are your thoughts?