getElementById replaces text, i want something that doesn't

Joined
12 Feb 2006
Posts
17,639
Location
Surrey
ok another small problem, i have a for loop and every loop it displays a link by getElementId and innerHTML.

the trouble with this rather then adding a new link
added to the element, it replaces everyone there.

how can i get it to not replace but add to the element?

thanks
 
Seriously, I'd check out DOM manipulation rather than .innerHTML... has serious benefits.

ok will do, is innerHTML javascript and DOM some sort of html? thats the what i was lead to beleive and this work i am doing is for coursework to show off javascript which is why i hadn't looked into DOM just yet.

while i have this thread open i got a small new problem. now i got the links to the sets to display fine im trying to get them to do what they are there for, to change set according to which number they are. now the problem i am having is sending the value of the link which is created by a loop through a function, the number for each loop isn't different, it is only the last loop amount, so in my case instead i got set 1, set 2, set 3, set 4, when the user clicks set 2 the value being 2 should be sent, but its always 4. is there a way to get value to be the same as the set?

part of my code

Code:
for  (y=1;y<=pageAmount;y++)

{ <p onclick='jumpSet(y)'>set " + y + "</p> "; }

it shows as a link for set 1, set 2, but the y value in jumpSet(y) is always the last loops y value
 
Back
Top Bottom