473,320 Members | 2,004 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 - IE6 (SP1) throws errors on Microsoft's own page!

I get more JS errors than I'd expect, on a wide range of sites. (It's
possible I only know this because the Debug is set on).

I found an error on a Microsoft site, and decided to investigate. I traced
it to this line:
document.all("characterCount").innerText = commentTextLength;

This is on a page deep inside a secure ordering sequence, so it's probably
not
worth copying the URL here.

According to my crib-sheet, "document.all" is only valid in the javascript
of IE4 and later. My browser is IE6 (SP1) which qualifies, but the
javascript I have doesn't like it. I also have other browsers and
Frontpage 2002 installed.

Any ideas? I do seem to see a lot of javascript errors, and not just my
own!

Here are the first lines of Javascript on the page, including the offending
line, marked with an added comment (//###....) on the line before:

------------------------------------

script src="/OMLibrary/script/functionsICS.js"
language="javascript"></script>
<!-- /common head -->
<SCRIPT LANGUAGE="javascript">
<!--
//---------------------------------------------------------
// this function counts up the text in the comment area and
// displays it on the page
//---------------------------------------------------------
function countText()
{
var commentText = document.forms.frmFeedback.commentArea.value;
var commentTextLength = 0;
commentTextLength = commentText.length;
//### marker comment added by OP - see next line ###
document.all("characterCount").innerText = commentTextLength;
if (commentTextLength > 1000)
{
alert('Please limit your comments to 1000 characters.');
document.forms.frmFeedback.commentArea.value =
commentText.substring(0,1000);
countText();
}
return true;
}

--
######################
## PH, London ##
######################
Jul 20 '05 #1
1 1232
Roland Hall wrote (in microsoft.public.intexplorer.scripting):
....
The reason is document.all is trying to reference the element by ID,
not name. So, to make it work, you need to add an ID to the SPAN.

That's it! Here's the original form code:

<td>
<textarea cols="50" rows="5" style="width:420px;"
onKeyUp="countText()" id="commentArea" name="sFeedbackComment"></textarea>
</td>

And the offending line from function CountText():

document.all("characterCount").innerText = commentTextLength;
Should be:
document.all("commentArea").innerText = commentTextLength;

The error was "document.all("...") is null or not an object. So it's just a
programming error, not something wrong with my setup.

--
######################
## PH, London ##
######################


Jul 20 '05 #2

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

Similar topics

1
by: John Kotuby | last post by:
Hi all, I have experienced several problems after installing SP1 for Visual Studio 2005 Professional. The problems are occurring on 2 different Windows XP SP2 development machines that have been...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: 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.