PDA

View Full Version : Student in need for your great assistance


el_publiko
06-06-2004, 05:59 AM
Hello to all!

I'm a student who was assigned to do a project on interioir designing using JavaScript, and i was hoping if you people could help me out with my problem.

May I know if it is possible to add multiple images using JS, like for example, I have a button that adds a chair (My project was INTERIOR DESIGNING), and no matter how many times i press it, an equivalent number of chairs should appear. Is that possible? If yes, please oh please tell me, I'm stuck on this problem for a week. If not, please do tell me. If there is some questions, please don't hesitate to ask, Thank You. Your replies will be greatly appreciated, Thank You.

Zee
08-07-2004, 11:19 PM
Hi el_publiko,

Assuming you simply want to add an image sequentially every time the button is clicked, create a span or div (based on your requirements) and give it a unique id.

The JavaScript function that's called might look something like the following:

function addImage(divObj) {
if (!document.createElement || !divObj.appendChild)
return;
var imgObj = document.createElement("img");
imgObj.src = "path/to/chair.jpg";
divObj.appendChild(imgObj);
}