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

D

davidemazza82

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
 
D

David Dorward

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.
 
H

Henry

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.
 

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