View Full Version : Help with displaying info based on item selection

Apr 23rd, 2010, 07:53 PM
Hi, I need help with a small problem. I'm trying to display info on a page after a user chooses an item from a list. The list will be at least 100 items or more long. This is what I've pieced together so far.


When a selection is made from the list on the left, the info needs to be displayed on the right. The info only has text at the moment, but I also need to display a small logo at the beginning of the paragraph.

If there is an easier way to do this changing the code I already have is not a problem. I'm just getting into learning css and have no experience with javascript other than copy/paste from other sites.

Thank you for any help you can provide.

Apr 23rd, 2010, 08:08 PM
You could change your array to be something like so:

myarr[2]['name']="American Cancer Society";
myarr[2]['description']="This is the American Cancer Society. What a great charity!";

Then your 'doit()' function would look like so:

function doIt(objval) {
var output = '';

output = output + myarr[objval]['name']+'<br />';
output = output + '<img src="'+myarr[objval]['image']+'" /><br />';
output = output + myarr[objval]['description']';

}I haven't tested this but hope it gives you a generaly idea :) Let me know if you have any questions about the above