0

Hi,

I am trying to code a game program in js that will allow the user to click on a "Roll Dice" button that calls a js function to randomly display various images of dice. My problem is that I cant find a way to display the images where I want. The only way so far I know is to use document.write but that creates a new page that displays only the image(s). What I want is for the images to appear in a certain cell of a table. This seems like it should be fairly easy to do but I cant find any information on the web.. Please help!

3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by Kadjii
0

Kadjii,

In a nutshell, you serve the page with <img> tags in all relevant table cells. Then, in response to whatever events, javascript changes the images by dynamically setting the <img>'s src.

Advice abounds. Search the web for "DHTML image replacement" or "javascript image replacement".

Airshow

0

Alternatly you could pop in img-tags where you want, but this tends to get messy. You could use javascript to fetch the correct column of the table and then simply insert a img.

0

Thanks for the info, I finally got it working. And I see now that I have 2 options for doing this

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.