tags:

views:

26

answers:

2
   <img src="images/icon2.png" border=0 onClick="window.document.getElementById('loadimg')">

<a href="images/img.jpg" id='loadimg'></a>

i want when click the image will active the link by id='loadimg' how can i do i try write onClick="window.document.getElementById('loadimg')" but not work

Than you

+3  A: 

You can put the image in the link:

<a href="images/img.jpg" id='loadimg'>
    <img src="images/icon2.png" border="0" />    
</a>
SLaks
Exactly! I can't find a reason why an image cannot be wrapped by an anchor. Is there one?
Igor Zinov'yev
no i want to load slider by parent image(album) and when click image album will load slider with all image when put image inside link will show all imae but i not this
Mahran Elneel
+2  A: 

It seems you want the item in the link to be loaded so something like this should work:

window.location.href = window.document.getElementById('loadimg').href;

This will cause the broswer page to navigate to this url.

Or was there something else you wanted to do?

Hogan