473,671 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reading External JavaScript File

4 New Member
Hey:

I have: <head><script language="javas cript" type="text/javascript" src="sideMenu.j s"></script></head>

and

<body><script >
document.write( doThis(''));
</script></body>

Why is it that it will not recognize doThis(o) in the file but will if sideMenu.js' contents are in the head tags on the html page, it will work?

The file sideMenu.js contains:
function doThis(o) {
document.write( ' <tr>')
document.write( ' <td><a href="">Home</a></td>')
document.write( ' </tr>')
}
Nov 3 '07 #1
5 1485
yoel
4 New Member
Hey:

I have: [HTML]<head><script language="javas cript" type="text/javascript" src="sideMenu.j s"></script></head>
[/HTML]
and

[HTML]<body><script >
document.write( doThis(''));
</script></body>[/HTML]

Why is it that it will not recognize doThis(o) in the file but will if sideMenu.js' contents are in the head tags on the html page, it will work?

The file sideMenu.js contains:
Expand|Select|Wrap|Line Numbers
  1. function doThis(o) {
  2. document.write(' <tr>')
  3. document.write(' <td><a href="">Home</a></td>')
  4. document.write(' </tr>')
  5. }
Thank you.
Nov 3 '07 #2
yoel
4 New Member
Solved! .
Nov 3 '07 #3
yoel
4 New Member
Solved! .
Nov 3 '07 #4
RMWChaos
137 New Member
So what was the problem?
Nov 4 '07 #5
acoder
16,027 Recognized Expert Moderator MVP
Threads merged. Please do not double post.
Nov 4 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2022
by: John B. | last post by:
In an effort to turn a little more a module with my pages, I would like to turn my internal javascripts into an external javascript files to supply the information onto a web page. I still getting the hang of javascript, and I've searched the web, but
1
3402
by: George Ziniewicz | last post by:
.. I have an html file with javascript functions in the <head> section that work fine when called from events or instanced as objects. When I move the functions to an external js file they don't work (timers don't run). What pitfalls are there in having "external" functions, is there a scope problem like in c?
7
2977
by: Iain Downie | last post by:
Anyone out there know of an easy way to fill a Java ArrayList in a JSP from an array of strings held in a external JavaScript file? We need to load up a large number of strings into the page and manipulate with JSP, and feel that the best way is for the users to have the bulk of the text 'cached' on their machine in a .js file rather than read from a database every time they access. The strings will rarely change. If not, any other...
17
2769
by: CES | last post by:
All, I was wondering if their is a way of loading an external script fill from within a script?? <script language="javascript" type="text/javascript"> function test(var){ <script language="javascript" src="../scripts/base.js" type="text/javascript" /> } </script> Obviously this would cause n error but this would give you an idea of what I'm looking to do. I know I can do this with a simple include but...
1
2254
by: mb | last post by:
Hi, I picked up this JavaScript code (quiz code) at: http://javascript.internet.com/miscellaneous/multiple-choice-quiz.html and modified it (and may have deleted some line I shouldn't have) so that it looks like this on my web site: http://www.goalseek.net/Scripts/qa_XL_History.htm
4
2639
by: fmaxwell | last post by:
Dear Group I have a very frustrating problem. I have been trying to make it more difficult to access external javascript files by using PHP sessions. This works beautifully locally (both in IE6 and IE7) and online in IE7, but frustratingly, online in IE6, the javascript does not render on the page, unless you refresh the page. Is there something different about the way IE6 handles sessions? Why
38
4009
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 single <scripttag, but have that external JS file insert into ITSELF the contents of five others? Something like: /*start external.js*/
1
3316
by: Brian Kendig | last post by:
I've got some questions about using an external javascript file, included via '<script type="text/javascript" src="mycode.js" ></ script>': (1) If I define a function "myFunction()" in the original HTML file, and reference it by "onMouseDown='myFunction();'" in a tag, it works. But if I move the myFunction() definition to an external javascript file, Firefox tells me "myFunction is not defined". Why is this, and how can I be able to...
3
1842
by: RICHARD BROMBERG | last post by:
I have a simple program to test using an external .js file. This external file contains some functions that I need to call from several html programs. The program as written below works fine. 1. <html> 2. <head> 3. <meta http-equiv="Content-Language" content="en-us"> 4. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> 5. <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> 6. ...
0
8472
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8390
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8909
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8819
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8596
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7428
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4221
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4399
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1801
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.