Results 1 to 4 of 4

Thread: I am trying to run two scripts on the front page

  1. #1
    Join Date
    Mar 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I am trying to run two scripts on the front page

    I am trying to run a menu script and a scroller script on the same page. page was working fine when I have just menu on it or just scroller on it. Minute I add second script in the header the menu quits. What do I do?

    here is <head> script one:
    <script type="text/javascript" src="includes/browser.js">
    /***********************************************
    * Jim's DHTML Menu v5.7- © Jim Salyer (jsalyer@REMOVETHISmchsi.com)
    * Visit Dynamic Drive: http://www.dynamicdrive.com for script and instructions
    * This notice must stay intact for use
    ***********************************************/
    </script>
    <script type="text/javascript" src="config.js"></script>




    here is <head> script two:
    <script type="text/javascript" language="JavaScript1.2" src="ajlib.js"></script>
    <script type="text/javascript" language="JavaScript1.2" src="ajscroller.js"></script>

    Please, I do not know a thing about Java.. can someone help me figure this out, please? thanks in advance.. PCL

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

    Default

    Note: Questions regarding multiple script usage are not usually replied to due to their time consuming nature. See this thread for more information, and this tutorial for one possible solution.
    - John
    ________________________

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

  3. #3
    Join Date
    Mar 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thanks for the help in pointing me in a direction!

    I had no idea where to even start. I have all the time in the world, and am glad to do it myself. I just had no idea where to even start. Thanks for taking the time to "show me the way". I really appreciate it very much. s

  4. #4
    Join Date
    May 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool

    paynecou:

    I am also successfully running more than one javascript on an html page..
    If you review the code posted below, you'll see How I call each of the scripts..

    Code:
    <html>
    <head><title>Welcome to PSP Embroidery!</title>
    <script language="JavaScript" type="text/javascript" >
    if (document.images) {
        var boardNum = 0;
        var boardSpeed = 2000;
    
        // Create an array of images for the billboard 
        var billboard = new Array();
        billboard[0] = new Image();
        billboard[0].src = "zsk-intl.jpg";
        billboard[1] = new Image();
        billboard[1].src = "ginko.gif";
        billboard[2] = new Image();
        billboard[2].src = "squirrel_logo.gif";
    
        // Create an array of URLs that correspond to the images
        var url = new Array();
        url[0] = "http://www.zsk.com";
        url[1] = "http://www.strawberrystitch.com/shop/GD-Sales.html";
        url[2] = "http://www.gonutsgocreative.com/home/default.asp";
    }
    
    // Function to rotate the images on the billboard
    function rotateBoard() {
        if (boardNum < (billboard.length - 1)) {
             boardNum++;
        }
        else {
            boardNum = 0;
        }
        document.billboard.src = billboard[boardNum].src;
        setTimeout('rotateBoard()', boardSpeed);
    }
    
    // Function to load the appropriate URL when the user clicks on an image
    function jumpBillboard() {
        window.location = url[boardNum];
    }
    
    </script>
    <SCRIPT SRC=ban1_rotate.js LANGUAGE=
      JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
    </SCRIPT>
    </head>
    
    <body BACKGROUND="scotch.bmp" onLoad="rotate();if (document.images) setTimeout('rotateBoard()', boardSpeed);">
    See, one of the critical things is that you enclose your individual scripts within their respective <script></script> tags, and that you handle the call to the functions properly within the <BODY> tag, like above!

    Review this link: http://www.javascriptkit.com/javatut...iplejava.shtml

    Good Luck!
    JavaTom

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
  •