jreamer
11-23-2004, 07:43 PM
The problem:
I'm trying to replace an image with a hyperlinked image. However, the hyperlinked image corresponds to a javascript function - not a URL. Because I am using a simple div/innerhtml replace function, I end up with a call to a javascript function from within another javascript function. Basically I have javascript within javascript. Because of the clash of ' - I get an error. My question is how do I embed the one call within the other so that the 's don't get mixed up?
Here is my code:
<div id="imgZoom"><img src="thumb.gif"></div>
<a href="#"><img src="thumb.gif" onClick="change('imgZoom','<a href=javascript:zoom('large.jpg')><img src=normal.jpg></a>');"></a>
I'm trying to replace an image with a hyperlinked image. However, the hyperlinked image corresponds to a javascript function - not a URL. Because I am using a simple div/innerhtml replace function, I end up with a call to a javascript function from within another javascript function. Basically I have javascript within javascript. Because of the clash of ' - I get an error. My question is how do I embed the one call within the other so that the 's don't get mixed up?
Here is my code:
<div id="imgZoom"><img src="thumb.gif"></div>
<a href="#"><img src="thumb.gif" onClick="change('imgZoom','<a href=javascript:zoom('large.jpg')><img src=normal.jpg></a>');"></a>