www.webdeveloper.com
Results 1 to 10 of 10

Thread: how can ui get an elements list?

  1. #1
    Join Date
    Jan 2003
    Location
    Israel
    Posts
    1,381

    how can ui get an elements list?

    i have few rows that are made with asp
    each row is like this :
    <td id="td1">wefqwer</td>

    and so on, where the id gt the value of the index in the loop which means :
    id="td"+i

    how can i know i javascript how many elements of that id i have got?
    thanks in advance
    peleg
    WebCssDesign
    Israel the best place to leave in = after Heaven

  2. #2
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    You could just do it in ASP. Keep track of the number of rows you are writing, and when you are done, write that number to a JavaScript variable... If that won't work for you, take a look at this:

    Code:
    <script type="text/javascript">
    maxnum = 50; //choose some number heigher than the max number possible
    x=0;
    function checkNum() {
    	for (i=0; i<maxnum; i++) {
    		if (document.getElementById("foo"+i)) {
    			x++;
    		}
    	}
    	alert (x);
    }
    onload = checkNum;
    </script>
    </head>
    <body>
    <div id="foo1"></div>
    <div id="foo2"></div>
    <div id="foo3"></div>

    Personal website http://www.ryanbrill.com/
    Business website: http://www.infinitywebdesign.com/
    TypeSpace http://www.typespace.org/

    I reject your reality and substitute it with my own!

  3. #3
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    From peleg
    Jerusalem - The Capitol City of Israel for ever...
    That rather reminds me of a line from a song by Meatloaf, "I said I'd love you 'till the end of time. Now I'm waiting for the end of time so I don't have to love you no more."

    1) A very considerable number of us on this planet still consider Jerusalem to be the rightful capitol of a free and sovereign Palestine.

    2) Such political comments, both yours and mine, are wholly inappropriate for this forum.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  4. #4
    Join Date
    Aug 2003
    Location
    London, United Kingdom
    Posts
    117
    <html>
    <head>
    <script language="javascript">
    function tdCount()
    {
    var tds = document.getElementsByTagName("TD");

    for(var i=0; i<tds.length; i++)_{
    if (document.getElementById('td_'+i))
    {alert('Count is '+ i); }
    }
    }
    </script>
    </head>
    <body>
    <table border="1">
    <tr>
    <td id="td_0" onclick="tdCount()">Cell 1</td>
    <td id="td_1">Cell 2</td>
    </tr>
    </table>
    </body>
    </html>
    You end up being who you are.
    http://www.geocities.com/lillamarta

  5. #5
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    6,119
    Please refrain from using this forum for religious or culturally controversial statements.Its not the policy of the forum to let this happen.You will for sure end up losing the privilege to post in these forums.
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

  6. #6
    Join Date
    Jan 2003
    Location
    Israel
    Posts
    1,381

    do u tell this to me or

    to Charles>?
    WebCssDesign
    Israel the best place to leave in = after Heaven

  7. #7
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    6,119
    primarily you.
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

  8. #8
    Join Date
    Jan 2003
    Location
    Israel
    Posts
    1,381

    me?what di i do?

    that is my signutare
    i dont see it political but the a basic thing for me like
    brithing
    WebCssDesign
    Israel the best place to leave in = after Heaven

  9. #9
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270

    Re: me?what di i do?

    Originally posted by pelegk1
    that is my signutare
    i dont see it political but the a basic thing for me like
    brithing
    Having read the private message you sent me, I see your point. I imagine that such hate as you seem to have becomes a constant friend and something that you don't even notice. Please do not contact me ever again.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  10. #10
    Join Date
    Jan 2003
    Location
    Israel
    Posts
    1,381

    if that what you think it means

    you didnt understand even a word of what i wrote!
    i dont have any hate against the palestiniens
    if you have read between the lines you chould understand that


    after i read some news-paper from canada i understand where
    your hate to us come's from!
    WebCssDesign
    Israel the best place to leave in = after Heaven

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles