By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,629 Members | 1,703 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,629 IT Pros & Developers. It's quick & easy.

Javascript not working in IE

P: n/a
I have some Javascript that is not working at all in IE and works fine in
Mozilla.

I stripped the page down to nothing where it only calls the function which
only does an alert.

I don't get the alert and I get an error that says:

Object expected

What is causing these problems?

Here is the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN">
<html>
<head>
<script language="javascript1.4">
function SalaryDisplay(me,dest)
{
alert("inside SalaryDisplay");
}
</script>
<title>Home Page</title>
</head>
<body class="ApplicantBody">
<br>From:<input name="WagesMin" type="text" size="10" id="WagesMin"
onChange="SalaryDisplay(this,'SalaryMin');" />
</body>
</html>
Thanks,

Tom
Jul 23 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
tshad wrote:
I have some Javascript that is not working at all in IE and works fine in
Mozilla.

I stripped the page down to nothing where it only calls the function which
only does an alert.

I don't get the alert and I get an error that says:

Object expected

What is causing these problems?

Here is the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN">
<html>
<head>
<script language="javascript1.4">


That line above is walking, living, typed out reason to never use the
language attribute. Evidently IE ignores that version so it never sees
the script block. Change it to the preferred (required) type attribute
and it "works" in IE6:

<script type="text/javascript">

<FAQENTRY>
Something about the type attribute being required and language
attributes causing problems in certain browsers? javascript1.4 being a
problem in IE6.
</FAQENTRY>

A search of the FAQ for "type=" and "language=" are unfound. Is it
covered in a Notes page somewhere?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #2

P: n/a

"Randy Webb" <Hi************@aol.com> wrote in message
news:hq********************@comcast.com...
tshad wrote:
I have some Javascript that is not working at all in IE and works fine in
Mozilla.

I stripped the page down to nothing where it only calls the function
which only does an alert.

I don't get the alert and I get an error that says:

Object expected

What is causing these problems?

Here is the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN">
<html>
<head>
<script language="javascript1.4">
That line above is walking, living, typed out reason to never use the
language attribute. Evidently IE ignores that version so it never sees the
script block. Change it to the preferred (required) type attribute and it
"works" in IE6:

<script type="text/javascript">

<FAQENTRY>
Something about the type attribute being required and language attributes
causing problems in certain browsers? javascript1.4 being a problem in
IE6.
</FAQENTRY>

A search of the FAQ for "type=" and "language=" are unfound. Is it covered
in a Notes page somewhere?


You're right.

Apparently, you don't need the "type" attribute if you use
language="javascript" and you need the "type" attribute if you use
language=javascript1.4.

I just love consistency.

Thanks,

Tom
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly

Jul 23 '05 #3

P: n/a
tshad wrote:
"Randy Webb" <Hi************@aol.com> wrote in message
news:hq********************@comcast.com...


<--snip-->

A search of the FAQ for "type=" and "language=" are unfound. Is it covered
in a Notes page somewhere?

You're right.

Apparently, you don't need the "type" attribute if you use
language="javascript" and you need the "type" attribute if you use
language=javascript1.4.


Dont use the language attribute, always use the type attribute. Now you
have consistency.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #4

P: n/a
tshad wrote:
[...]

You're right.

Apparently, you don't need the "type" attribute if you use
language="javascript" and you need the "type" attribute if you use
language=javascript1.4.

I just love consistency.


As Randy indicated, 'language' is depreciated, 'type' is required:

type = content-type [CI]
This attribute specifies the scripting language of the element's
contents and overrides the default scripting language. The
scripting language is specified as a content type (e.g.,
"text/javascript"). Authors must supply a value for this
attribute. There is no default value for this attribute.

language = cdata [CI]
Deprecated. This attribute specifies the scripting language of the
contents of this element. Its value is an identifier for the
language, but since these identifiers are not standard, this
attribute has been deprecated in favor of type.

<URL:http://www.w3.org/TR/html401/interact/scripts.html#edef-SCRIPT>

--
Rob
Jul 23 '05 #5

P: n/a
"RobG" <rg***@iinet.net.auau> wrote in message
news:9q****************@news.optus.net.au...
tshad wrote:
[...]

You're right.

Apparently, you don't need the "type" attribute if you use
language="javascript" and you need the "type" attribute if you use
language=javascript1.4.

I just love consistency.


As Randy indicated, 'language' is depreciated, 'type' is required:

type = content-type [CI]
This attribute specifies the scripting language of the element's
contents and overrides the default scripting language. The
scripting language is specified as a content type (e.g.,
"text/javascript"). Authors must supply a value for this
attribute. There is no default value for this attribute.

language = cdata [CI]
Deprecated. This attribute specifies the scripting language of the
contents of this element. Its value is an identifier for the
language, but since these identifiers are not standard, this
attribute has been deprecated in favor of type.

<URL:http://www.w3.org/TR/html401/interact/scripts.html#edef-SCRIPT>


That should solve the problems.

Thanks,

Tom
Jul 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.