inherit
170346
0
Mar 1, 2016 12:53:37 GMT -8
Shorty
Yeah, I'm that cool. Lol! No I'm not.
3,018
August 2011
shortyverrett94
|
Post by Shorty on Jun 18, 2012 13:49:00 GMT -8
Can someone please explain innerHTML to me. I have looked it up, but it makes absolutely no sense to me. I mean I get it a little bit. What can you do with it. Like the .match? What can you match? What others things like that can you use?
|
|
#00AF33
Bark Different.
102833
0
1
Feb 12, 2023 16:57:46 GMT -8
RedBassett
I'm a Marxist/Lennonist of the Groucho/John variety.
15,405
April 2007
applecomputer
RedBassett's Mini-Profile
|
Post by RedBassett on Jun 18, 2012 14:15:25 GMT -8
Can someone please explain innerHTML to me. I have looked it up, but it makes absolutely no sense to me. I mean I get it a little bit. What can you do with it. Like the .match? What can you match? What others things like that can you use? <div><span>Hello World!</span></div> "<span>Hello World!</span>" is the inner HTML of the div. "Hello World!" is the inner HTML of the span. It just means what is inside of an element. Can be treated like a string.
|
|
inherit
170346
0
Mar 1, 2016 12:53:37 GMT -8
Shorty
Yeah, I'm that cool. Lol! No I'm not.
3,018
August 2011
shortyverrett94
|
Post by Shorty on Jun 18, 2012 14:33:56 GMT -8
How would u write that in code?
|
|
#00AF33
Bark Different.
102833
0
1
Feb 12, 2023 16:57:46 GMT -8
RedBassett
I'm a Marxist/Lennonist of the Groucho/John variety.
15,405
April 2007
applecomputer
RedBassett's Mini-Profile
|
Post by RedBassett on Jun 18, 2012 14:38:13 GMT -8
<div id="foo"><span id="bar">Hello World!</span></div>
document.getElementById('foo').innderHTML document.getElementById('bar').innerHTML
Those are like variables, so you can read or set them.
|
|
inherit
170346
0
Mar 1, 2016 12:53:37 GMT -8
Shorty
Yeah, I'm that cool. Lol! No I'm not.
3,018
August 2011
shortyverrett94
|
Post by Shorty on Jun 18, 2012 14:41:03 GMT -8
Can u do it to something that doesn't have an id?
|
|
#00AF33
Bark Different.
102833
0
1
Feb 12, 2023 16:57:46 GMT -8
RedBassett
I'm a Marxist/Lennonist of the Groucho/John variety.
15,405
April 2007
applecomputer
RedBassett's Mini-Profile
|
Post by RedBassett on Jun 18, 2012 14:44:45 GMT -8
Yes, however you will need to know how to make the selection in Javascript.
You can get an array of elements by name, select by n-th child of parent, etc.
The .innerHTML property simply is assigned to HTML DOM, so if you can select an HTML element from the DOM, then you can use that on it (assuming it has innerHTML). May get iffy on head elements and their children however.
|
|
inherit
170346
0
Mar 1, 2016 12:53:37 GMT -8
Shorty
Yeah, I'm that cool. Lol! No I'm not.
3,018
August 2011
shortyverrett94
|
Post by Shorty on Jun 18, 2012 14:57:24 GMT -8
could you do the getElementByTagName
|
|
inherit
97216
0
Nov 26, 2024 13:53:14 GMT -8
Bennett 🚀
Formerly iPokemon.
3,622
January 2007
catattack
iPokemon's Mini-Profile
|
Post by Bennett 🚀 on Jun 18, 2012 15:12:03 GMT -8
document.getElementsByTagName("td") will get all the td elements, document.getElementsByTagName("tr") will get all the tr elements. You have to use a for loop to traverse these since they return an array. Or just stick a key indicator ([#]) like document.getElementsByTagName("tr")[0]
|
|
inherit
170346
0
Mar 1, 2016 12:53:37 GMT -8
Shorty
Yeah, I'm that cool. Lol! No I'm not.
3,018
August 2011
shortyverrett94
|
Post by Shorty on Jun 18, 2012 15:16:25 GMT -8
What if the indicator number isn't always certain? Say you were trying to find text in a proboards thread td, you cant always assume that the td is always the same number. what would be the method for that? or could you not?
|
|
inherit
97216
0
Nov 26, 2024 13:53:14 GMT -8
Bennett 🚀
Formerly iPokemon.
3,622
January 2007
catattack
iPokemon's Mini-Profile
|
Post by Bennett 🚀 on Jun 18, 2012 15:29:17 GMT -8
You would loop through them all, as I said previously
|
|
inherit
170346
0
Mar 1, 2016 12:53:37 GMT -8
Shorty
Yeah, I'm that cool. Lol! No I'm not.
3,018
August 2011
shortyverrett94
|
Post by Shorty on Jun 18, 2012 15:31:27 GMT -8
how would you do that? edit: would you do the for(a=0;a<(variabe for getting td);a++ {
|
|
inherit
58740
0
Aug 20, 2024 7:29:21 GMT -8
®i©hie
I'm not very active here anymore thanks to my full-time job. - 12/27/23
14,036
September 2005
soe
|
Post by ®i©hie on Jun 18, 2012 15:33:53 GMT -8
|
|
inherit
97216
0
Nov 26, 2024 13:53:14 GMT -8
Bennett 🚀
Formerly iPokemon.
3,622
January 2007
catattack
iPokemon's Mini-Profile
|
Post by Bennett 🚀 on Jun 18, 2012 15:35:19 GMT -8
how would you do that? edit: would you do the for(a=0;a<(variabe for getting td).length;a++ { Indeed. a++; = a++ btw. no semi-colon at the end
|
|
inherit
170346
0
Mar 1, 2016 12:53:37 GMT -8
Shorty
Yeah, I'm that cool. Lol! No I'm not.
3,018
August 2011
shortyverrett94
|
Post by Shorty on Jun 18, 2012 15:37:48 GMT -8
|
|
inherit
58740
0
Aug 20, 2024 7:29:21 GMT -8
®i©hie
I'm not very active here anymore thanks to my full-time job. - 12/27/23
14,036
September 2005
soe
|
Post by ®i©hie on Jun 18, 2012 15:42:57 GMT -8
|
|