Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: JavaScript Conflict

  1. #1
    Join Date
    Jul 2005
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default JavaScript Conflict

    Hey Guys

    I am a new member of the dynamic drive forums and I need some help.

    The reason for this message is in response to the post below titled 'Mouse cursor and trailing' (I thought id start a new thread although I also posted it as a response below)

    I noticed John was very helpful in his response and I was wondering if anyone would be so kind as to help my with a similar dillema that I am having with JavaScript...

    Basically I have created a website and I have employed a menu system using javascript (along with other javascripts in the same page.) These all work fine but when I attempt to incorporate a mouse trailer javascript code, it simply does not work as there seems to be a conflict with the other javascript scripts in the webpage, whereas the other scrips work fine.

    I tried the links and the tutorial provided by jscheuer1 in the post below but they do not apply to me as I am not using an onLoad script within the body tag of my webpage. (except onLoad=set() to display the date)

    My question is in regard to the following quote:

    QUOTE

    One other approach that works in both situations is to put one script in a borderless iframe. It will look like it is on the same page but, since it really is on a separate page, conflicts are no longer an issue.

    UNQUOTE

    My question therefore is:

    How can I get the javascript coding in the IFRAME of my webpage to work / execute on all other pages? As the javascript seems to be executed in the IFRAME only and not the main page where I want it to work. Bascially the mouse trailer now works in the IFRAME and not the main page of the website so I want to 'pull' in the javascript from this IFRAME into the main pages of the website so that there will no longer be a conflict of scripts as the IFRAME is on a separate page technically.

    I thought you guys would be the best to ask this question, as you all seem to know your stuff.

    Any answer to this question or help on solving this would greatly be appreciated.

    Kind Regards

    DJM

  2. #2
    Join Date
    Jul 2005
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    bah... I'm gonna become the new jscheuer answering all the stupid questions :P. Well I don't know what the script is but I can answer your question none the less. Just cut-and-paste the code onto your main page since the iFrames content is on another page right. so obviously it would only be executed on that one right so just cut-and-past my good man. And if it now doesn't work in the iframe just copy-and-paste the code into the iFrame. I'm not exactly sure how the script works so I can't give you a definite answer but what I've told you should work.

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I've since updated my advice about using the multiple scripts via an iframe(s). It now is:
    One other approach that works in both situations, if adaptable to one (or more) of the scripts, is to put one script in a borderless iframe. It will look like it is on the same page but, since it really is on a separate page, conflicts are no longer an issue.
    'If adaptable' is the key concept and Willdawg is right, the trailer script will not be active outside the iframe. This approach works well for slideshows, tickers and whatnot, not for document wide effects.
    Quote Originally Posted by djm
    I tried the links and the tutorial provided by jscheuer1 in the post below but they do not apply to me as I am not using an onLoad script within the body tag of my webpage. (except onLoad=set() to display the date)
    Only takes one in the body tag and then another in a script.

    I'm not sure which mouse trailer you are trying to use but, they all (as far as I know) have onload events. These can be for insertion into the the body tag or a part of the script itself. All onloads on a given page must be combined in some fashion in order for them all to work.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Jul 2005
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thanks

    Thanks for the response guys

    well I have tried the cut and paste method as you say but like I said, there is a javascript conflict thats why I thought of using the javascript in a separate page, IE the IFRAME.

    I am using the 'Image Trail Script' from dynamic drive:

    http://www.dynamicdrive.com/dynamicindex13/trailer.htm

    As far as I know it does not use an onLoad event.

    I have tried taking out the date script with the onLoad=set() but the image trailer script still does not work which I think is due to the 'coolmenus' menu system I have employed using extensive javascript coding

    Regards

    DJM

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    From the script:
    Code:
    if (B){
    window.onload=getedgesIE
    window.onresize=getedgesIE
    }
    If you trace back through the code this basically means that if the browser is IE, use these two events. The 'window.onload' is the same as an onload event in the body tag. Since there are at least three scripts involved in your situation, it is unlikely I can find a solution without a copy of your page with all the scripts on it (working or not) to look at. The best way to do this is to put a demo online somewhere and provide a link to it. You could also post the code or if it is too long to post, attach it, to a message here. If you post code, surround it in [code][/code] tags in the message so it looks like this:
    Code:
    some code here
    and disable smilies in text (see below the full message editor for this and the attachment options).
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Jul 2005
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default code attached

    ok I have attached a txt file containing the code in my first page (apologies for containing the entire code) so i hope this is what you meant?

    The image trailer script however is not included in this code for obvious reasons (it does not work)

    If you want me to attach the image trailer code too I will attach it to another message

    Regards

    DJM

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Well, to trouble shoot the trailer script with your code, yes I would need it as it appears on your best attempt. The code you attached presents other problems when trying to debug it.

    1 ) Linked scripts for which I have no code.

    2 ) Graphics that do not show up.

    3 ) Linked external style that I don't have.

    Ideally all paths would be absolute and point to existing live files. Do you have a site? If so, the best thing is to upload a demo there and give me the url to it. You can just call it test.htm, it doesn't have to be linked to from any other page on your site and doesn't have to work. It does have to have all the stuff on it and linked to it, available as existing live files.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #8
    Join Date
    Jul 2005
    Location
    cali
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Willdawg
    bah... I'm gonna become the new jscheuer answering all the stupid questions :P. Well I don't know what the script is but I can answer your question none the less.
    Don't you think that that is kind of rude, when you don't even know.

  9. #9
    Join Date
    Jul 2005
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    In response to jscheuer1, I do not currently have a website online thus I dont think I will be able to do it that way. Il have a think and see what I can do. However the website will be relased online in a couple of weeks so I could leave the image trail script for now and when I put the website online I can provide you with the link so that I can add the script later.

    Otherwise I cant think of anything else...except that the linked files do not work etc as they are not provided with the txt file I uploaded but everything works fine when all scripts and images etc are linked at my end.

    I appreciate your help and I'l try think of another way or if you know anyer way then just let me know.

    Also in response to bubba.daniel- Thanks but I guess Willdawg just didnt understand what I was trying to say regarding my problem in my first post

    Cheers

    DJM

  10. #10
    Join Date
    Jul 2005
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Man why do you want one of those anyways they're cheesey looking haha.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •