"object expected" error in ie

J

jman

i'm getting an "object expected" error in ie - not ff.

in the BODY onload attribute i call a function that's
loaded from an external file.

i've narrowed the error down to the fact it cannot find
this function.

<script src="external.js">

<body onload="func()">

func() is in external.js

works in other browsers - any help?
 
S

SAM

jman a écrit :
i've narrowed the error down to the fact it cannot find
this function.

<script src="external.js">

<body onload="func()">

func() is in external.js

works in other browsers - any help?

<script src="external.js" type="text/javascript"></script>

<body onload="func()">


certainly my Fx would do as your IE
 
E

endangeredmassa

i'm getting an "object expected" error in ie - not ff.

in the BODY onload attribute i call a function that's
loaded from an external file.

i've narrowed the error down to the fact it cannot find
this function.

<script src="external.js">

<body onload="func()">

func() is in external.js

works in other browsers - any help?

As SAM said, IE requires that you open and close the script tag. Try
doing this:
<script src="external.js" type="text/javascript"></script>
 
T

Thomas 'PointedEars' Lahn

[...]
i've narrowed the error down to the fact it cannot find
this function.

<script src="external.js">

<body onload="func()">

func() is in external.js

works in other browsers - any help?

As SAM said, IE requires that you open and close the script tag.

That is required in *all* user agents, because anything else is invalid
markup, and relying on error correction is recommended against, because
it is error-prone. The end tag of the `script' element is not optional:

http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.1
http://validator.w3.org/


PointedEars
 

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,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top