LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 12-06-2006, 01:14 PM   #1
RHLinuxGUY
Member
 
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, 02:52 PM   #2
paulsm4
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:

http://dojotoolkit.org/

Just a thought .. PSM
 
  


Reply


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 07:14 AM
Reset the HTML content of a div with javascript phil.d.g Programming 5 02-14-2006 03:29 AM
Javascript / HTML <select> tag djgerbavore Programming 3 04-23-2005 11:51 AM
Html Javascript help apt Programming 3 03-21-2005 12:46 AM
changing an HTML table with javascript eantoranz Programming 2 10-29-2004 01:21 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:38 AM.

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