SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot
    Join Date
    Apr 2001
    Posts
    194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem running 2 scripts on the same page ;(

    Hi guys does anyone know why this is happening? If you take a look at http://www.mason-williams.co.uk/mac/newstest.html you will see that I'm trying to configure a iframe to display news in. However there is a conflict between the menu script that is running on the same page. When I remove the following code the iframe works…

    <script language="javascript" src="sniffer.js">
    //Top Navigational Bar III (By BrotherCake @ cake@brothercake.net)

    //Permission granted/modified by Dynamicdrive.com to include script in archive

    //For this and 100's more DHTML scripts, visit http://www.dynamicdrive.com
    </script>

    However when I remove this code my menu system at the top will not work. ;(

    Do any of you guys know how I can resolve this and make both the scripts run on the same page?

    Cheers,

    dEVS!

  2. #2
    SitePoint Zealot
    Join Date
    Dec 1999
    Location
    Highlands Ranch, CO
    Posts
    193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you post the code that is in the sniffer.js, and the code for your menu?

  3. #3
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    1) check all global variable & function names -- in all likelihood, one or more are being used by both scripts
    2) use the browser's built-in debugger -- look at the line (and a few above it) where the error message points to
    3) put an alert or two within the functions to see how far the scripts run and at which point they collapse.

    Chad: if you bothered to look at the page, save it; the js files will be downloaded

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still

  4. #4
    SitePoint Addict
    Join Date
    Aug 2001
    Location
    Los Angeles, CA
    Posts
    346
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    if you have a problem onloading two scripts....

    Just do this if you have a problem onloading two scripts at the same time or you need to do that:

    <body bgcolor="#FFFFFF" onload="function1(),function2()">

    That will load two functions at the same time. I noticed you wrote in your script "window.onload=...." you might want to put that in your body tag.

    Gregory C.

  5. #5
    SitePoint Zealot
    Join Date
    Dec 1999
    Location
    Highlands Ranch, CO
    Posts
    193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Vincent,

    Thanks for the advice.

    Just trying to help a fellow web developer.

    if you bothered to look at the page
    You know, if the code is posted, then I can try to find the errors & right there. I was just lookin' around at the questions on the board <quickly> and politely asked for him to post the code.

    Now Vincent, if YOU had bothered, you could have 'saved the page' debugged the script as well. But apparently you didn't want to 'bother' going through that either.

  6. #6
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Chad,

    I apologize. I forgot I was 'talking' to a stranger who couldn't see my facial expressions and hear my tone. What I had meant was exactly what you said -- that I couldn't be bothered -- and I had presumed that you had (bothered, as in expended more energy than I had) but had not realized that by saving the file, you would have the js file. Again, I apologize.

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still


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
  •