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:55:47 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:59:56 GMT -8
|
|
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 16:11:02 GMT -8
okay. now say theres 2 imglinks and you want both to have something different after it. would you do
imglink[0]+=" hello"; imglink[1]+=" hello";
? ? ? ?
|
|
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 16:20:17 GMT -8
|
|
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 16:22:48 GMT -8
How would that differentiate? because the html to find for both images is the same, so wouldnt just add hello hello to the end of both images?
|
|
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 16:25:25 GMT -8
How would that differentiate? because the html to find for both images is the same, so wouldnt just add hello hello to the end of both images? you could change what you wanted after the senond image, see my edit above.
|
|
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 16:31:30 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 16:33:24 GMT -8
change the RED to td
for(a=0; a<tr.length; a++){
so it should be:
for(a=0; a<td.length; a++){
|
|
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 16:54:13 GMT -8
Still no
|
|
inherit
97216
0
Nov 23, 2024 12:51:52 GMT -8
Bennett 🚀
Formerly iPokemon.
3,622
January 2007
catattack
iPokemon's Mini-Profile
|
Post by Bennett 🚀 on Jun 18, 2012 18:03:42 GMT -8
It's not in a table, so it has nowhere to try and get it from. Put it in a standard table then do it again.
|
|
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 18:07:54 GMT -8
i honestly am the biggest retard. like really. i'm stupid. but still no
|
|
inherit
97216
0
Nov 23, 2024 12:51:52 GMT -8
Bennett 🚀
Formerly iPokemon.
3,622
January 2007
catattack
iPokemon's Mini-Profile
|
Post by Bennett 🚀 on Jun 18, 2012 19:50:37 GMT -8
I'm getting an error about "getElementByTagName". find "getElementByTagName" and replace it with "getElementsByTagName".
EDIT:
<script type="text/javascript"> if(document.getElementByTagName('td').innerHTML.match(/werqwer/)) alert('Found It'); </script>
<script type="text/javascript"> var td = document.getElementsByTagName("td"); for(t=0;t<td.length;t++){ if(td[t].innerHTML.match(/werqwer/)){ alert("found it!"); break; } } </script>
EDIT 2: If i get what you're trying to do there, do something like this:
<script type="text/javascript"> var links = document.getElementsByTagName("a"); for(l=0;l<links.length;l++){ if(links[l].innerHTML.match(/werqwer/)){ alert("found it!"); break; } } </script>
|
|
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 20:22:27 GMT -8
The second code has the "s" in Elements. The last code didn't work either.
|
|
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 20:24:07 GMT -8
The second code has the "s" in Elements. The last code didn't work either. My objective was to see if on the thread page it would alert. But neither worked.
|
|
inherit
24252
0
Aug 1, 2023 15:01:24 GMT -8
coolcoolcool
When the world says, "Give up," Hope whispers, "Try it one more time."
2,148
May 2004
coolcoolcool
|
Post by coolcoolcool on Jun 19, 2012 15:53:16 GMT -8
There's nothing wrong with iPokemon's syntax other than that he used getElementByTagName instead of getElementsByTagName in his first script.
You'll have to post your html if I'm going to be able to tell you why it's not working. Make sure to test this on a page with proper <html> and <body> tags as well.
You can think of .innerHTML as a property of each tag. The document renders it and displays it, but when using javascript, taking an element named elem and going:
var value = elem.innerHTML;
Will set value to elem's innerHTML. However, the value is passed by value and NOT by reference, so if you then changed value it would not change elem's innerHTML. If you want to change elem's innerHTML you have to do it directly like the following.
elem.innerHTML = "html";
or
elem.innerHTML += "html"; //appends html to the current
or
elem.innerHTML = elem.innerHTML.replace("val","newval");
Also, in a for loop, it executes every line inside the { } block until it reaches a break or continue, so if you want to differentiate between different elements you have to use separate if-statements to deal with the different cases. If you want something to effect all links of a specific type, use an if statement that is ambiguous. For example, assume this is inside a for-loop:
if(element.className.match(/catbg/i)) //do stuff to all the catbg elements
For more advanced manipulation, read up on javascript DOM.
|
|