Click to See Complete Forum and Search --> : i need help with id tags


Littleonetwo
12-13-2006, 12:08 PM
hi, ive been trying to get this page that im working on for school to work but i dont understand what i am doing wrong it keeps telling me id not defined, but i have clearly defined it, ive tried many different ways to get this thing to just work using the id properties but no luck.
i have attached a txt file that is the exact copy of what i currently have, any help would be much appreciated, and time is of the essence. thanks again.

edit: i prolly should explain what im trying to achieve, im trying to make a lil slide puzzle, by using an array filled with values, then make it possible to click on said values in a table to make them move, but i cant even get the place holder values to change.

abz
12-13-2006, 12:21 PM
what is meant to happen? If you want to target something with javascript you have to do it properly:

document.getElementById('myItem').value="value";

and what is 'innerText' meant to be? do you mean innerHTML?

Littleonetwo
12-13-2006, 12:26 PM
im not sure what innerText is supposed to mean, im using a book for reference and it is used to change values with the id tag, so i was doing what the book was showing but it wasnt working and i looked all different places online, but a search engine cant comprehend only search, so i came here.

what is meant to happen for now.. is you click the button and the first table cell changes into a value held in the array, in this case the number 0, but i couldnt get that step to work.

thanks.

ok using what you gave me, it got rid of the error for the id not defined, but it still didnt change what was in the cell, any advice?

abz
12-13-2006, 12:28 PM
this is for an assignment yes? maybe you shoudl ask your lecturer for help. that is what they are there for. I get your code to work by changing to innerHTML, and targeting the ID properly

Littleonetwo
12-13-2006, 12:31 PM
thanks... i would but he only checks his email every once in a while, and i kinda waited till the last moment to pump this out, its all on me, but thanks for the help.

Fang
12-13-2006, 12:49 PM
Microsoft: obj.innerText
Firefox: obj.textContent
Both: obj.innerHTML
DOM:obj.firstChild.data

Littleonetwo
12-13-2006, 01:16 PM
thanks alot, ill remember that fang, abz what you said worked like a charm thanks so much.