Including script in HTML

Discussion in 'Javascript' started by Berry B, Feb 16, 2004.

  1. Berry B

    Berry B Guest

    Hi!
    I'm extremely new to JavaScript programming, so bear with me pleace.
    I'm having trouble including a script into a page from an external .js file.
    I've put the following in the head;

    <script language="JavaScript" src="menu.js"></script>

    And in the body i've put the following:

    <BODY bgcolor="#000000" marginwirgin: 0" onLoad="printMenu()"
    onResize=dth="0" marginheight="0" style="ma"if (isNS4) nsResizeHandler()">

    The problem is that the function printMenu doesn't run, I just keep getting
    runtime errors in IE, and the menu buttons will not show. Any suggestions?

    Tnx!
     
    Berry B, Feb 16, 2004
    #1
    1. Advertising

  2. Berry B

    JCO Guest

    Can we assume that you have the function "printMenu()" in menu.js?
    If so, is menu.js at the root or in a folder?
    If in a folder, you need to add the folder path, i.e....
    "my_scripts/menu.js"



    "Berry B" <> wrote in message
    news:40300fcd$...
    > Hi!
    > I'm extremely new to JavaScript programming, so bear with me pleace.
    > I'm having trouble including a script into a page from an external .js

    file.
    > I've put the following in the head;
    >
    > <script language="JavaScript" src="menu.js"></script>
    >
    > And in the body i've put the following:
    >
    > <BODY bgcolor="#000000" marginwirgin: 0" onLoad="printMenu()"
    > onResize=dth="0" marginheight="0" style="ma"if (isNS4) nsResizeHandler()">
    >
    > The problem is that the function printMenu doesn't run, I just keep

    getting
    > runtime errors in IE, and the menu buttons will not show. Any suggestions?
    >
    > Tnx!
    >
    >
     
    JCO, Feb 16, 2004
    #2
    1. Advertising

  3. Berry B

    Berry B Guest

    Yes, the function is in menu.js, and menu.js lies in the root folder. Are
    there any other ways to include the script in the head of the page? Any
    other ways to call a function in the body tag?
    I would be very glad if someone posted an example!

    Dag Erik

    " JCO" <> wrote in message
    news:fIYXb.15088$...
    > Can we assume that you have the function "printMenu()" in menu.js?
    > If so, is menu.js at the root or in a folder?
    > If in a folder, you need to add the folder path, i.e....
    > "my_scripts/menu.js"
    >
    >
    >
    > "Berry B" <> wrote in message
    > news:40300fcd$...
    > > Hi!
    > > I'm extremely new to JavaScript programming, so bear with me pleace.
    > > I'm having trouble including a script into a page from an external .js

    > file.
    > > I've put the following in the head;
    > >
    > > <script language="JavaScript" src="menu.js"></script>
    > >
    > > And in the body i've put the following:
    > >
    > > <BODY bgcolor="#000000" marginwirgin: 0" onLoad="printMenu()"
    > > onResize=dth="0" marginheight="0" style="ma"if (isNS4)

    nsResizeHandler()">
    > >
    > > The problem is that the function printMenu doesn't run, I just keep

    > getting
    > > runtime errors in IE, and the menu buttons will not show. Any

    suggestions?
    > >
    > > Tnx!
    > >
    > >

    >
    >
     
    Berry B, Feb 16, 2004
    #3
  4. Berry B

    Ivo Guest

    "Berry B" <> wrote in message
    news:40300fcd$...
    > Hi!
    > I'm extremely new to JavaScript programming, so bear with me pleace.
    > I'm having trouble including a script into a page from an external .js

    file.
    > I've put the following in the head;
    >
    > <script language="JavaScript" src="menu.js"></script>
    > <BODY bgcolor="#000000" marginwirgin: 0" onLoad="printMenu()"
    > onResize=dth="0" marginheight="0" style="ma"if (isNS4) nsResizeHandler()">


    The script tag needs a type declaration these days, the language may be kept
    for backward-compatibily.
    The quotes around the values of the attributes in the BODY tag don't look
    very balanced to me, and I have never heard of marginwirgin or "ma" as a
    style property. And in the event of a resize, a variable dth gets set to the
    value of 0 as a string. I hope you know what that means.
    A cleaned up example:

    <script language="JavaScript" type="text/javascript" src="menu.js"></script>
    <BODY bgcolor="#000000" marginwidth="0" marginheight="0"
    onLoad="printMenu();" onResize="dth='0';">
     
    Ivo, Feb 17, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bob Walton
    Replies:
    0
    Views:
    923
    Bob Walton
    Jul 19, 2003
  2. Valli
    Replies:
    1
    Views:
    1,139
    Mike Placentra II
    Oct 3, 2007
  3. Christopher
    Replies:
    2
    Views:
    108
    Timothy Goddard
    Jul 5, 2006
  4. Sandip Chitale
    Replies:
    0
    Views:
    94
    Sandip Chitale
    Nov 20, 2003
  5. Ralf Koms
    Replies:
    4
    Views:
    163
    Ralf Koms
    Oct 12, 2004
Loading...

Share This Page