variables in div tags?
I am having trouble displaying a picture in a div tag in the body of my page. I think the problem lies in the fact that I need to use a variable to display the image and it is not carrying over for some reason.
The variables are all global and defined correctly in the functions. I hope this makes sense. If anyone can offer some advice, I will gladly try any thing. I can't even come up with any more search strings.
Here is the latest code I tried for inside the div tags...
document.write("<img name='jpg' src='jpg files/" + myList2[loopJPG] + "' width='811' height='607'>");
Originally Posted by itsrick
wow thanks for the quick reply. Sorry for the delay in posting - this is the first time I've been in front of a computer all day (that's both good and bad).
I don't have the code with me right now but I know that all of my variables are global because I am using them all in a few different functions where they keep the same value.
This is a huge dillemma because I cannot display the picture without the variable.
I have tried so many different variations already it is hard to list them all. When I get back to my own computer I will put the code up but for now I would really appreciate it if anyone could offer some friendly advice. Thanks.
no errors just a blank page when it is supposed to load the image.
I just tried a simple test. In the div I posted above, I wrote
document.write("hello"); which worked.
But when I put
document.write(myList2); nothing happened.
myList2 is global because it is passed from one function to the other and I know it holds its value through the script.
Yes you can. I think I need to see some code to figure out whats wrong.
Thank you for trying to help. There is a hole in the wall shaped exactly like my head - it is no coincidence. I will post some code when I get back to the house in about an hour.
Also, in your original code you tried to iterate through an array with a string without quotes:
But as pepejeria said, we'll need to see some code to fully understand the problem.