Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Including a Javascript external file from the <body> part of an HTML file

Reply
Thread Tools

Including a Javascript external file from the <body> part of an HTML file

 
 
davidemazza82@gmail.com
Guest
Posts: n/a
 
      09-26-2007
Hi all,

I got an [object error] from IE 7.0.5730.11 when moving the <script
src="..." type="text/javascript" /> tag from the <head> part to the
<body> section of a HTML file.

Is not possibile to include Javascript code via <script src="..."
type="text/javascript" /> from the <body> section, instead from the
<head> one? If yes, anyone has any idea of which the problem could be?
If not, how can I programmatically include a javascript external file
inside the <body> part of a HTML file, for example, using Javascript
to some particular native functions?

Tnx a lot

Bye
David

 
Reply With Quote
 
 
 
 
David Dorward
Guest
Posts: n/a
 
      09-26-2007
On Sep 26, 11:25 am, davidemazz...@gmail.com wrote:
> I got an [object error] from IE 7.0.5730.11 when moving the <script
> src="..." type="text/javascript" /> tag from the <head> part to the
> <body> section of a HTML file.


Don't use <script ... /> unless you are serving your XHTML as
application/xhtml+xml, it causes things to break.
http://www.w3.org/TR/xhtml1/#C_3

> Is not possibile to include Javascript code via <script src="..."
> type="text/javascript" /> from the <body> section, instead from the
> <head> one?


Yes.

> If yes, anyone has any idea of which the problem could be?


Trying to use something in on script that depends on the other script
running first is a good bet.

--
David Dorward
http://dorward.me.uk/
http://blog.dorward.me.uk/

 
Reply With Quote
 
 
 
 
Henry
Guest
Posts: n/a
 
      09-26-2007
On Sep 26, 11:25 am, davidemazz...@gmail.com wrote:
> Hi all,
>
> I got an [object error] from IE 7.0.5730.11 when moving the
> <script src="..." type="text/javascript" /> tag from the <head>
> part to the <body> section of a HTML file.
>
> Is not possibile to include Javascript code via <script src="..."
> type="text/javascript" />


Not in an HTML document, as the closing script tag is required/
necessary.

> from the <body> section, instead from the
> <head> one?


There are plenty of valid (in (x) HTML terms) contexts with a BODY
element into which script elements that import external scripts can be
placed (and even more where doing so is practical).

> If yes, anyone has any idea of which the problem could be?


There are probably millions of things that you could do in order to
get the error output you suggest. That makes speculation a bit
pointless.

> If not, how can I programmatically include a javascript external file
> inside the <body> part of a HTML file,


There is no reason for doing it programmatically. Identify the cause
of the error and address that instead.

> for example, using Javascript
> to some particular native functions?


That does not make sense.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disadvantage of including JavaScript files within a JavaScript file? vunet Javascript 2 07-08-2008 03:18 PM
Including one external JS file directly into another Neo Geshel Javascript 36 03-18-2007 09:39 PM
Including external javascript code in a web page David D. Javascript 8 12-03-2004 04:17 PM
Including HTML files within another HTML file Ralf Koms Javascript 4 10-12-2004 10:49 PM
Including an external file outside the application using JSP INCLUDE sravan Java 0 10-01-2004 04:44 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57