473,386 Members | 1,610 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,386 software developers and data experts.

enumerator not working in firefox

The following script works in IE but in Firefox errors with the msg
Enumerator is not defined.
<html>
<head>
<meta name="vs_defaultClientScript" content="JavaScript">
<script language="javascript">
<!--
function Recalc(){
var objHidden;
var objControl;
var objLabel;
var n = 0;
var sName;
var e = new Enumerator(document.getElementsByName("txt"));
while(!e.atEnd()){
alert(e.item().value);
e.moveNext();
}
};

//-->
</script>
<script id="clientEventHandlersJS" language="javascript">
<!--

function Button1_onclick() {
return Recalc();
}

//-->
</script>
</head>
<body>
<form>
<INPUT id="Text5" type="text" name="txt">
<INPUT id="Text4" type="text" name="txt">
<INPUT id="Text2" type="text" name="txt">
<INPUT id="Text3" type="text" name="txt">
<INPUT id="Text1" type="text" name="txt">
<INPUT id="Button1" type="button" value="Button" name="Button1"
language="javascript" onclick="return Button1_onclick()">
</form>
</body>
</html>

Mar 30 '06 #1
5 5223
toldyouso wrote:
The following script works in IE but in Firefox errors with the msg
Enumerator is not defined.


Where have you defined it?

--
Ian Collins.
Mar 30 '06 #2
Do I have to define Enumerator, isn't part of the javascript language?
I didn't define it for IE...

Mar 30 '06 #3
toldyouso wrote:
^^^^^^^^^
Who?
The following script works in IE but in Firefox errors with the msg
Enumerator is not defined.
Enumerator is defined in Microsoft JScript (primarily to facilitate
interaction with other MS software, such as ADO), not in JavaScript.

See also <URL:http://pointedears.de/scripts/es-matrix>.
[...]
<script language="javascript">
<script type="text/javascript">

See <URL:http://validator.w3.org/>.
<!--
Nonsense. Search the archives for "comment" and the like.
[...]
var e = new Enumerator(document.getElementsByName("txt"));
while(!e.atEnd()){
alert(e.item().value);
e.moveNext();
}
While it would be possible to write an Enumerator implementation for
JavaScript, the following is easier and works in IE-based UAs, too:

var e = document.getElementsByName("txt");
for (var i = 0, len = e.length; i < len; i++)
{
alert(e[i].value);
}

See also <URL:http://pointedears.de/scripts/test/whatami#inference>.
};
I doubt there is a point in ending a FunctionStatement with a `;', besides
the fact that it is indeed a statement. It rather helps to confuse a
standalone FunctionStatement with a FunctionExpression in an assignment.
//-->
Nonsense.
</script>
<script id="clientEventHandlersJS" language="javascript">
Utter nonsense. The (X)HTML `script' element has no `id' attribute (by
default), nor would it be necessary here.
[...]
<INPUT id="Text1" type="text" name="txt">
type="text" is redundant, that is the default attribute value for this
element.
<INPUT id="Button1" type="button" value="Button" name="Button1"
language="javascript" onclick="return Button1_onclick()">


The (X)HTML `input' element has no `language' attribute (by default).
Again, the `id' attribute does not strike me as being necessary here.

Your indentation sucks.
PointedEars
Mar 31 '06 #4
toldyouso wrote:
Do I have to define Enumerator,
No.
isn't part of the javascript language?
If you mean (Netscape) JavaScript, then no.
I didn't define it for IE...


IE uses (Microsoft) JScript.
PointedEars
Mar 31 '06 #5
Thanks for the info and the sweet criticism.

Mar 31 '06 #6

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

Similar topics

2
by: Gordon Rundle | last post by:
It drives me nuts that I can't use foreach with an enumerator instance. I would like the following to be functionally identical: foreach (Object o in MyCollection) ... foreach (Object o in...
2
by: Stephanie Stowe | last post by:
Hi. I am trying to understand the weird System.DirectoryServices object model. I have a DirectoryEntry object. I want to enumerate through the PropertyCollection. So I looked at GetEnumerator....
11
by: rawCoder | last post by:
Hi, Which is better in terms of performance. Iterating over Enumerator ForNext loop (using indexer) ForEach loop Thanx rawCoder
6
by: Mark Olbert | last post by:
The doPostBack javascript functioning is not submitting the page when called by linkbuttons (or an autopostback checkbox, for that matter). I'm aware of a problem with Netscape browsers and the...
18
by: Rob Panosh | last post by:
Hello, When traversing an ArrayList which is faster? For Each oItem as Something in me.ArrayList ..... ..... Next OR
3
by: ajmastrean | last post by:
I have a bunch of enumerators. I need to pass them into a function that is designed to write all values of any enumerator to the console. For instance... public enum Days : int { Sunday = 1,...
7
by: csharpula csharp | last post by:
Hello, I have methods which refer to some class enumerator .Should I make it pulic or encapsulate it? *** Sent via Developersdex http://www.developersdex.com ***
6
by: Michael C | last post by:
I'm reading about Iterators and the article I'm reading states that an enumerator must load all of the objects into memory, which is obviously a big waste if there are a large number of objects and...
3
by: Dave | last post by:
I'm calling string.Split() producing output string. I need direct access to its enumerator, but would greatly prefer an enumerator strings and not object types (as my parsing is unsafe casting...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.