Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 12-06-2006, 12:14 PM   #1
Registered: Oct 2003
Distribution: Ubuntu 7.04
Posts: 889
Blog Entries: 1

Rep: Reputation: 30
JavaScript: Want to get the amount of html 'names'.

Preface: I am a JS newbie... thankfully it looks like C++, so things are going smooth.

For my JavaScript function... I am making a constructor run at the 'onload' event when the html interpretor(?) reaches the body tag. In this function, I have a loop that goes through all the images that need to be loaded, and I would like to know if I can get the number of 'names' properties found in my html. Example:

<img name="textbar">
<img name="something">

Gotta go to next class, but here: how do I get the length of amount of names that are found.
Old 12-06-2006, 01:52 PM   #2
LQ Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

One problem you might run into is that your page might still be loading asynchronous to your script executing - so even if you FOUND a count .. it might not be valid.

Suggestion - try looking at the Dojo Toolkit. It might already offer precisely the functionality you're trying to build yourself. And it CERTAINLY has lots of other goodies you can use ... and that will make your introductory adventures in Java scripting both more productive, and a lot more satisfying:

Just a thought .. PSM


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML or Javascript combo select rblampain Programming 5 08-29-2006 06:14 AM
Reset the HTML content of a div with javascript phil.d.g Programming 5 02-14-2006 02:29 AM
Javascript / HTML <select> tag djgerbavore Programming 3 04-23-2005 10:51 AM
Html Javascript help apt Programming 3 03-20-2005 11:46 PM
changing an HTML table with javascript eantoranz Programming 2 10-29-2004 12:21 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:57 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration