473,405 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Including script in HTML

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!
Jul 20 '05 #1
4 1671
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"

"Berry B" <da*****@stud.ntnu.no> wrote in message
news:40********@news.broadpark.no...
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!

Jul 20 '05 #2

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" <J.********@verizon.net> wrote in message
news:fI*******************@nwrddc02.gnilink.net...
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" <da*****@stud.ntnu.no> wrote in message
news:40********@news.broadpark.no...
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!


Jul 20 '05 #3
Ivo
"Berry B" <da*****@stud.ntnu.no> wrote in message
news:40********@news.broadpark.no...
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';">
Jul 20 '05 #4
In article <40********@news.broadpark.no>,
"Berry B" <da*****@stud.ntnu.no> wrote:
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


You may put the functions at the <head> section of you HTML file.

Example:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>clientquesta</TITLE>

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">

<SCRIPT type="text/javascript">

function out(comment)
{

alert("This is a inline function " + comment );
}

</script>

</HEAD>
<BODY onload="out('from point 1.');">

<br><br>A silly alert will appear.

</BODY>

</HTML>
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Newbie | last post by:
Hi all, I have some activeX code that I use to get the local computer name. (I don't think this is possible using ASP from my research). The rest of my code is ASP. I'd like to know how to...
4
by: Prowler | last post by:
In the application we are currently building, we need to write positioning code on-the-fly, based upon the screen offset of the element in the AS/400 application which drives the Web app. The 400,...
9
by: Trenqo 0 | last post by:
I'm looking for a way to include javascript files from within a ".js" file. This would allow me to only need to link to one ".js" file, and yet still organize my functions into non gargantuan files...
8
by: david.lindsay.green | last post by:
Hello all, I am quite new a web scripting and making web pages in general and I have stumbled across a problem I have as yet been unable to solve. I am trying to take the contents of a textarea box...
3
by: Mr. Roper | last post by:
I'm pretty weak when it comes to Java script, hopefully someone will take mercy on my sole and explain this to me. How come on the following HTML page, when I have my first script tag commented...
38
by: Neo Geshel | last post by:
I am seeking a method to load one JS file directly into another, *without* having to dynamically write <scripttags. Is there any method whereby I can call only one external JS file using a ...
10
by: Robert Huff | last post by:
Can someone offer suggestions why, on the same server (Apache 2.2.8), this works <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en-US"> <head> <link rel=stylesheet...
4
by: r_ahimsa_m | last post by:
Hello, I am learning WWW technologies in Linux. I created index.html file which I can browse with Firefox/Konqueror using URL localhost/~robert/rozgloszenia/index.html. The page looks fine but...
1
by: vunet | last post by:
What's the possible disadvantage of including JavaScript files within a JavaScript file? Why I needed it? For the sake of easy management, perhaps? Any load speed disadvantage? Example below: ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.