Connecting Tech Pros Worldwide Help | Site Map

Javascript not working in IE

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 23rd, 2005, 07:01 PM
tshad
Guest
 
Posts: n/a
Default Javascript not working in IE

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



  #2  
Old July 23rd, 2005, 07:01 PM
Randy Webb
Guest
 
Posts: n/a
Default Re: Javascript not working in IE

tshad wrote:[color=blue]
> 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">[/color]

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
  #3  
Old July 23rd, 2005, 07:01 PM
tshad
Guest
 
Posts: n/a
Default Re: Javascript not working in IE


"Randy Webb" <HikksNotAtHome@aol.com> wrote in message
news:hqOdna_JQPhbKMjfRVn-3A@comcast.com...[color=blue]
> tshad wrote:[color=green]
>> 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">[/color]
>
> 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?[/color]

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[color=blue]
>
> --
> Randy
> comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly[/color]


  #4  
Old July 23rd, 2005, 07:01 PM
Randy Webb
Guest
 
Posts: n/a
Default Re: Javascript not working in IE

tshad wrote:
[color=blue]
> "Randy Webb" <HikksNotAtHome@aol.com> wrote in message
> news:hqOdna_JQPhbKMjfRVn-3A@comcast.com...
>[/color]

<--snip-->
[color=blue][color=green]
>>
>>A search of the FAQ for "type=" and "language=" are unfound. Is it covered
>>in a Notes page somewhere?[/color]
>
>
> 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.[/color]

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
  #5  
Old July 23rd, 2005, 07:02 PM
RobG
Guest
 
Posts: n/a
Default Re: Javascript not working in IE

tshad wrote:
[...][color=blue]
>
> 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.[/color]

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
  #6  
Old July 23rd, 2005, 07:02 PM
tshad
Guest
 
Posts: n/a
Default Re: Javascript not working in IE

"RobG" <rgqld@iinet.net.auau> wrote in message
news:9qj5e.793$Zn.40634@news.optus.net.au...[color=blue]
> tshad wrote:
> [...][color=green]
>>
>> 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.[/color]
>
> 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>[/color]

That should solve the problems.

Thanks,

Tom


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.