crazyone
inherit
-149588
0
Dec 3, 2024 11:40:10 GMT -8
crazyone
0
January 1970
GUEST
|
Post by crazyone on Aug 5, 2005 22:04:28 GMT -8
like some maybe know, I'm learning javascript, and everything was okay until I came to a poin that I couldn't use anymore the basic thing:
<script> var TD = document.getElementsByTagName("TD") for(i=0;i<TD.length;i++){ if(TD[i].width=="60%" && TD[i].align=="left" && TD[i].innerHTML.match(/Total Posts:/i)){ TD[i].innerHTML+="<br />text to add" }} </script>
but that I have a td without any specific things, so I guess I need to go to the next TD and do this:
TD[i-1].innerHTML+="<br />text to add"
but is there a method that you give some info about the table, and go after that to the td in that table? Probably it is, but I don't know how, so can someone help me?
|
|
inherit
Proboards Legend
212
0
May 11, 2006 12:32:55 GMT -8
california
21,035
December 1999
california
|
Post by california on Aug 6, 2005 0:57:33 GMT -8
Well if you're wanting to go to the next td, you should use TD[i+1]. You could also use TD.nextSibling. Either way is fine.
|
|
crazyone
inherit
-149590
0
Dec 3, 2024 11:40:10 GMT -8
crazyone
0
January 1970
GUEST
|
Post by crazyone on Aug 6, 2005 3:33:32 GMT -8
Well if you're wanting to go to the next td, you should use TD[i +1]. You could also use TD .nextSibling. Either way is fine.little fault, but I know how that works, but how can I get a td with specifying a table? TD .nextSibling is a little bit more difficult, lets stay at the old way
|
|
squalleh
inherit
-149591
0
Dec 3, 2024 11:40:10 GMT -8
squalleh
0
January 1970
GUEST
|
Post by squalleh on Aug 6, 2005 5:58:56 GMT -8
Well if you're wanting to go to the next td, you should use TD[i +1]. You could also use TD .nextSibling. Either way is fine.little fault, but I know how that works, but how can I get a td with specifying a table? TD .nextSibling is a little bit more difficult, lets stay at the old way You want to search tables, but grab a specific cell? Well, that works by: object.rows [##].cells [##] Specify the row number and then the cell number, and you'll have a specific cell.
|
|
crazyone
inherit
-149592
0
Dec 3, 2024 11:40:10 GMT -8
crazyone
0
January 1970
GUEST
|
Post by crazyone on Aug 7, 2005 3:57:09 GMT -8
little fault, but I know how that works, but how can I get a td with specifying a table? TD .nextSibling is a little bit more difficult, lets stay at the old way You want to search tables, but grab a specific cell? Well, that works by: object.rows [##].cells [##] Specify the row number and then the cell number, and you'll have a specific cell. thanks I'll give it a try
|
|
lwf
New Member
Posts: 59
inherit
54412
0
Aug 10, 2012 8:50:01 GMT -8
lwf
59
August 2005
lwf
|
Post by lwf on Aug 11, 2005 10:03:29 GMT -8
how do you add java script to your website
|
|
crazyone
inherit
-149594
0
Dec 3, 2024 11:40:10 GMT -8
crazyone
0
January 1970
GUEST
|
Post by crazyone on Aug 11, 2005 23:10:52 GMT -8
how do you add java script to your website 1)Do not hijack a thread 2)make yourself one 3)make him in the correct board 4) forum or a real website? 5)if forum, then in the headers and the footers.If website then at the place you want it, or in the header (some parts). 6)can someone close this thread, as it is answered, and it seems to work (first tests).
|
|