Ah, ok, You've almost got it. If this is hard for you, then let me give you some advice on how to go about it.
This line is the problem:
document.getElementById(i).innerHTML =<img src='+i+"p.jpg"'>;
Let's say you wanted to make them all 13p.jpg. Just to make things easier. To do that, you would use this code:
document.getElementById(i).innerHTML = '<img src="13p.jpg">';
Notice that quotes are required around the entire string that you want to assign to innerHTML. Single quotes or double quotes, your choice, but I usually use single quotes for the JavaScript since the HTML inside the string is required to have double quotes. (If you used *double* quotes to surround the string, then you would have to precede the inside double quotes with backslashes. But we won't get into that right now.)
OK. Now it's important to realize that those double quotes within '<img src="13p.jpg">' have absolutely nothing to do with the single quotes surrounding the whole thing. That distinction is important when we take the variable i into the picture:
document.getElementById(i).innerHTML ='<img src="' + i + '.jpg">';
I just cut the string into two halves, and then concatenated them with the value of the variable i inbetween. What you see there is a combination of the following three things:
<imc src="
the value of i
.jpg">
The first of the three things is a string - you want that actual text to be part of innerHTML. So you have to put it in quotes.
The second of the three things is the value of a variable. You can just put the variable there and it will automatically insert its value into the string.
The third of the three things is another string which requires quotes around it.
All three must be joined with a + sign, as follows:
'<img src="' + i + '.jpg">'
So that should work.
There is one more thing required for it to work: the elements whose innerHTML's you're changing must have IDs set to "13", "14", "15", etc. That's because of this part:
document.getElementById(i)
The variable i has the values 13, 14, 15, etc, so the code is going to try to change the elements with those IDs. If your elements have IDs more like "image13", "image14", etc, or "num13", "num14", etc, or anything else with more than just the number, then you'll have to replace the i in document.getElementById(i) with a string that will match the IDs. For example, document.getElementById('image' + i).
Hope that helps.
[This message has been edited by Slime (edited 05-26-2002).]