Including script in HTML

B

Berry B

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!
 
J

JCO

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"
 
B

Berry B

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
 
I

Ivo

Berry B said:
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';">
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top