473,404 Members | 2,187 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,404 software developers and data experts.

What's the execution pattern of this function?

1
Expand|Select|Wrap|Line Numbers
  1. function getElementsByClass(className) {
  2.     var all = document.all ? document.all : document.getElementsByTagName('*');
  3.     var elements = new Array();
  4.     for (var i = 0; i < all.length; i++)
  5.         if (all[i].className == className)
  6.             elements[elements.length] = all[i];
  7.     return elements;
  8. }
the function shown above is a javascript fuction.i would like to know the execution Pattern of getElementByClass()
Aug 3 '07 #1
3 1527
pbmods
5,821 Expert 4TB
Heya, ansi. Welcome to TSDN!

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

Changed thread title to better describe a problem (threads tend to get more responses when the title contains nouns *and* verbs, with emphasis on plural).
Aug 3 '07 #2
gits
5,390 Expert Mod 4TB
moved from js-articles-section to the js-forum ...
Aug 3 '07 #3
acoder
16,027 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. function getElementsByClass(className) {
  2.     var all = document.all ? document.all : document.getElementsByTagName('*');
  3.     var elements = new Array();
  4.     for (var i = 0; i < all.length; i++)
  5.         if (all[i].className == className)
  6.             elements[elements.length] = all[i];
  7.     return elements;
  8. }
the function shown above is a javascript fuction.i would like to know the execution Pattern of getElementByClass()
What do you not understand in this function? It gets the elements in the document with a particular class name.
Aug 3 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: sayoyo | last post by:
Hello:) I wish to know if there is some pattern design that allow passing the result of one executing thread(at the end of the execution) to another thread. And it is possible to pass data...
8
by: Crash | last post by:
2 Questions, but first Consider this: I'm looking at a C++ class (patterned using the Singleton Design Pattern). It has some public and private operations. It runs quite happily seving the time...
12
by: nib | last post by:
What kind of problems is c best at solving?
6
by: Efim | last post by:
Hi all, Due to performance issue, I want to pevent execution of ToString() function in the code like the following: if(reporting_level & DEBUG_LEVEL) log(reporting_level,string.Format("Event of...
23
by: Xah Lee | last post by:
The Concepts and Confusions of Pre-fix, In-fix, Post-fix and Fully Functional Notations Xah Lee, 2006-03-15 Let me summarize: The LISP notation, is a functional notation, and is not a...
12
by: Joachim Pense | last post by:
Is there recommended way to get the execution plan for queries involving global temporary tables (from the UNIX command line or within a script)? I run the queries in Perl scripts, and the only...
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
12
by: Adrian | last post by:
The code below was taken from an example. All the "noise" in the example was thrown out. This is supposedly according to the bridge pattern. What in the code (which lines) represent the bridge...
34
by: Jorge | last post by:
Why is it listed here : http://www.crockford.com/javascript/recommend.html under "deprecation" ? Without it, how is an anonymous function() going to call itself (recursively) ? I use to...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.