473,320 Members | 1,910 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.

Find All Span Tags

I have a page which has multiple span tags, I would like a javascript
function that can look at each of these span tags for me. Depending
on the what the user is doing there could be a different number of
span tags so I don't want to hard code them.

Thanks

Eric
Jul 20 '05 #1
2 11927
co***@nimo.com (Eric Cota) writes:
I have a page which has multiple span tags, I would like a javascript
function that can look at each of these span tags for me. Depending
on the what the user is doing there could be a different number of
span tags so I don't want to hard code them.


var spans = document.getElementsByTagName("span");
for (var i=0;i<spans.length;i++) {
... spans[i] ...
}

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2


Eric Cota wrote:
I have a page which has multiple span tags, I would like a javascript
function that can look at each of these span tags for me. Depending
on the what the user is doing there could be a different number of
span tags so I don't want to hard code them.


var spans;
if (document.all) {
spans = document.all.tags('span');
}
else if (document.getElementsByTagName) {
spans = document.getElementsByTagName('span');
}
if (spans) {
// do something with it
}

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #3

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

Similar topics

1
by: sindre hiåsen | last post by:
Hi, What I try to do is to search a text for html tags. Why. Because I want to use nl2br on the text, but since this command add br instead of all /n it is not a nice thing to add t.x. a html...
0
by: Dean H. Saxe | last post by:
I'm currently developing a tool in perl to search out potential XSS (Cross Site Scripting) vulnerabilities and correct them in a ColdFusion based web app. I've been having great success so far,...
9
by: David Henderson | last post by:
Hi There... I'm struggling with a problem: I have a string (coming from a rich text editor) which contains a variety of span tags that need to be replaced with corresponding formatting tags....
2
by: arne | last post by:
Hi what would be the easiest way to find all tag's with a certain name (or class) below (within) a certain tag. Pref jscript DOM thx Arne
3
by: Thief_ | last post by:
I have the following data in a web page: <tr height="25"> <td nowrap class="odd" align="center"><img src="/forums/images/icon_topic_new.gif" width=14 height=14 alt='New Topic' border=0></td> ...
2
by: shapper | last post by:
Hello, Is there any validation problem using a <por a <h1tags inside a <spantag as follows: <span><p>Something</p><span> or <span><h1>Something</h1><span>
2
by: howa | last post by:
anyone heard that before?
1
by: jprimo | last post by:
Hi Everyone, I was wondering if anyone knew how to disable to span tags that appear in the place of ASP.NET labels ( <asp:Label ) after it has been processed by the server. I have a style sheet...
6
by: mangal | last post by:
Hi, I need of assistance to convert spans having style related bold, ital and underline & color into html bold, underline and/or italicize tags. Sample Input String: <p>In <span...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.