Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image OnClick Problem

Status
Not open for further replies.

zinja

MIS
Nov 14, 2002
149
0
0
US
I am trying to get this to work. I am making a table and one of the cell contents is an image. This image should have an onClick event that fires a function and passes on two pieces of data to that function.

here is where I make the cell contents:

Code:
celldata = '<img id="img'+i+'" onclick="createwindow('+title+',' +linkhtml+')" src="images/qtscreen.gif"/>';
		html+='<td>' + celldata + '</td>';

The value of linkhtml is a big string that refers to an object. Here is a sample of what that looks like:
Code:
<object id="id1" type="video/quicktime" width="163" height="16" data="media/tst.mov"><param name="src" value="media/test.mov"/><param name="controller" value="true"/>' +
'<param name="autoplay" value="false"/><param name="scale" value="tofit"/><param name="volume" value="100"/>' +
'<param name="loop" value="false"/></object>

I am getting the following when the table is generated:
Code:
)" src="images/qtscreen.gif"/>

That is what winds up in the cell where the image should be.

Any ideas?



Thanks,

LJ Wilson

My personal saying - Just remember, it can always get worse, and usually will.
 
If title and linkhtml are strings, they need to be quoted:

Code:
onclick="createwindow([!]\'[/!]' + title + '[!]\'[/!], [!]\'[/!]' + linkhtml + '[!]\'[/!])"

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top