Click to See Complete Forum and Search --> : document.write


5sisters
01-02-2003, 04:09 AM
I have the following on my site:-

document.write("<tr " + color + ">");
document.write("<td width=10% align=center valign=top><small><b>"+ShowCount);
document.write("<td width=75% align=left ><small>"+ToDoItem);
document.write("<td width=15% align=center><small>"+"<a href='javascript:DeleteItem(" + Count + ")'>Delete</a>");


The bit that reads:
document.write("<td width=75% align=left ><small>"+ToDoItem);

collects information from a cookie and displays it in a table...

Can I have this information displayed with a pop-up link and small image where the link and image has the same file name as the "ToDoItem"

i.e. if "ToDoItem" returned the value "Item_one"
then I would want the text "Item_one" displayed (as it already does) linked to Item_one.htm and then an image Item_one.jpg displayed

I tried:
document.write("<td width=25% align=left ><small><img src="+ToDoItem);+".jpg width=26 height=18>
for the image thing but I'm not much of an expert on javascript & it didn't work (I think it's something to do with having the " 's in the wrong place)



Hope someone can help

Charley.

swon
01-02-2003, 06:44 AM
Try this syntax:

document.write("<td width=25% align=left ><small><img src=\""+ToDoItem+".jpg\" width=26 height=18>");

Charles
01-02-2003, 09:52 AM
Or use:

document.write('<td width=25% align=left ><small><img src="'+ToDoItem+'.jpg" width=26 height=18>');

5sisters
01-02-2003, 11:05 AM
Thanks guys,

Worked a treat!!

:D :D

But only works for 1st 3 products yet until I get a chance to go through them all..

Thanks again for your help.

Happy New year.

Charley