473,320 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

JavaScript Vs. IE 6.0

Hi

i am a novice to JavaScript - and have started learning it using online
study material and a couple of books - slowly i am getting into
practicing it at my workplace (after work hours) - yesterday i suffered
a problem using toString() toLowercase() toUppercase() etc statements
in a html file - to learn arrays containing strings. when i ran this
prog on IE 6.0 it said "This object or function not supported".

what do i do and how do i get it going again? is this a conflict
between IE and JavaScript and if so, what could be the solution?

please help

thanx
raj

Aug 14 '05 #1
4 1697


beachlover wrote:

yesterday i suffered
a problem using toString() toLowercase() toUppercase() etc statements
in a html file - to learn arrays containing strings. when i ran this
prog on IE 6.0 it said "This object or function not supported".

what do i do and how do i get it going again?


It will give you a line number and then you have to check that line in
your code to correct the error, for instance strings have methods named
toLowerCase
and
toUpperCase
but not ones named toLowercase or toUppercase.
So make sure when you use JavaScript and properties or methods of
objects that you check the case of letters, it matters with JavaScript.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 14 '05 #2
javascript is case sensitive so you have to use toLowerCase and toUpperCase

bye
Luca

"beachlover" <ra****@gmail.com> ha scritto nel messaggio
news:11**********************@g47g2000cwa.googlegr oups.com...
Hi

i am a novice to JavaScript - and have started learning it using online
study material and a couple of books - slowly i am getting into
practicing it at my workplace (after work hours) - yesterday i suffered
a problem using toString() toLowercase() toUppercase() etc statements
in a html file - to learn arrays containing strings. when i ran this
prog on IE 6.0 it said "This object or function not supported".

what do i do and how do i get it going again? is this a conflict
between IE and JavaScript and if so, what could be the solution?

please help

thanx
raj

Aug 15 '05 #3
Hey Martin:
thanks for your quick response.. however, could you pls diagnose what
is wrong with the following code and where:

it shows an error:
----------------------------------------------------------------------
Line: 25
Char: 1
Error:"Object doesnt support this property or method"
Code: 0
----------------------------------------------------------------------
<HTML>
<head>
<title> The array object </title>
</head>
<body>
<br>
<h1 align="center">The array object </h1>
<hr>
<Script language = "JavaScript">
myArray=new Array (1,2,3,4,5,6,7,8,9,10,0)
document.write("<pre>")
document.write("myArray.toString()\t:\t\t")
document.write(myArray.toString()+"<BR>")
document.write("myArray.join('|')\t:\t\t")
document.write(myArray.join("|")+"<BR>")
document.write("myArray.reverse()\t:\t\t")
document.write(myArray.reverse()+"<BR>")
document.write("myArray.sort()\t\t:\t\t")
document.write(myArray.sort()+"<BR>")
document.write("</pre>")
document.write("<hr>")
myArray2=new Array ("This is first string. This is second string.")
document.write("<pre>")
document.write("myArray2.toLowerCase()\t\t:")
document.write(myArray2.toLowerCase()+"<BR>")
document.write("myArray2.toUpperCase()\t\t:")
document.write(myArray2.toUpperCase()+"<BR>")
document.write("myArray2.substring(8)\t\t:")
document.write(myArray2.substring(8)+"<BR>")
document.write("myArray2.substring(4,12)\t\t:")
document.write(myArray2.substring(4,12)+"<BR>")
document.write("myArray2.split('is')\t\t:")
document.write(myArray2.split('is')+"<BR>")
document.write("myArray2.charAt(9)\t\t:")
document.write(myArray2.charAt(9)+"<BR>")
document.write("myArray2.charCodeAt(2)\t\t:")
document.write(myArray2.charCodeAt(2)+"<BR>")
document.write("myArray2.indexOf('second')\t\t:")
document.write(myArray2.indexOf('second')+"<BR>")
document.write("</pre>")
</script>
</body>
</html>

thanks
raj

Aug 15 '05 #4
beachlover wrote:
Hey Martin:
thanks for your quick response.. however, could you pls diagnose what
is wrong with the following code and where:

it shows an error:
----------------------------------------------------------------------
Line: 25
Char: 1
Error:"Object doesnt support this property or method"
Code: 0
----------------------------------------------------------------------
Which points to exactly where the error is (see below).

[...] <Script language = "JavaScript">
The language attribute is depreciated, type is required:

<script type="text/javascript">

You're probably better off keeping tags either all uppercase or all
lowercase, it's not really important for HTML but when (if?) a
transition to XHTML takes place it may be significant.

[...] myArray2=new Array ("This is first string. This is second string.")
document.write("<pre>")
document.write("myArray2.toLowerCase()\t\t:")
document.write(myArray2.toLowerCase()+"<BR>")


You can get away with omitting semi-colons ';' in JavaScript but it
isn't a good idea. Much better to put them all in where they are
supposed to be.

This above is line 25. You are trying to call the toLowerCase method of
the array 'myArray2'. But arrays don't have a toLowerCase method,
strings do. You have two choices:

1. Declare myArray2 as a string:

myArray2 = "This is first string. This is second string.";

in which case it should perhaps be called 'aString' to avoid confusion
(I really loath anything called 'my' whatever).

2. Use a reference to an item within myArray that is a string:

document.write( myArray2[0].toLowerCase() + "<BR>" )

But I can't see the point of using an array when a simple string will do
the job.

You can also remove a heap of code by using only one document.write
statement for each block of stuff:

<script type="text/javascript">
myArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0];
document.write(
"<pre>",
"myArray.toString()\t:\t\t",
myArray.toString()+"<BR>",
"myArray.join('|')\t:\t\t",
myArray.join("|")+"<BR>",
"myArray.reverse()\t:\t\t",
myArray.reverse()+"<BR>",
"myArray.sort()\t\t:\t\t",
myArray.sort()+"<BR>",
"</pre>" + "<hr>"
);
aString = "This is first string. This is second string."
document.write(
"<pre>",
"aString.toLowerCase()\t\t:",
aString.toLowerCase()+"<BR>",
"aString.toUpperCase()\t\t:",
aString.toUpperCase()+"<BR>",
"aString.substring(8)\t\t:",
aString.substring(8)+"<BR>",
"aString.substring(4,12)\t\t:",
aString.substring(4,12)+"<BR>",
"aString.split('is')\t\t:",
aString.split('is')+"<BR>",
"aString.charAt(9)\t\t:",
aString.charAt(9)+"<BR>",
"aString.charCodeAt(2)\t\t:",
aString.charCodeAt(2)+"<BR>",
"aString.indexOf('second')\t:",
aString.indexOf('second')+"<BR>",
"</pre>"
);
</script>
[...]

--
Rob
Aug 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.