Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie Problem with External Javascript

Status
Not open for further replies.

prgmrgirl

Programmer
Joined
Feb 12, 2004
Messages
119
Location
US
Hi there,

I'm having a strange problem running a simple piece of javascript. When I run embed it in the html file, it works fine. When I move the code to an external file and call it, nothing appears on the page.

The code that in the javascript file is simply

Code:
document.write("This line is written from an external source.")

And I am calling it like this:

Code:
<script language="javascript" src="ExternalFile.js"></script>

Am I calling it incorrectly? I'm confused....

Many thanks for any help.

prgmrgirl
 
By any chance do you have <script> tags in your external file? It should not have them.

The complete contents of External.js

Not this
Code:
<script>
document.write("This line is written from an external source.");
</script>

But this
Code:
document.write("This line is written from an external source.");
 
Thanks for your reply! I discovered that I had accidently used document.Write (with a capital 'W') and not document.write. D'oh!

It's hard to distinguish caps in notepad! =P

thanks again!

prgmrgirl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top