364,085 Members | 5308 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

click on a link with onClick

alihaydar
P: 6
hi,

i'm trying to open a lightbox within a table cell with onClick, here is the code that works in firefox.. but it's not working in chrome.. is there a way?
or a better way to do this altogether?

Expand|Select|Wrap|Line Numbers
  1. <td onClick="document.getElementById('zorba').click()">Knye</td>
  2.  
  3. <a style="display: none;" href="knye.htm" title="Knye" id="zorba" rel="lightbox">Knye</a>
  4.  
Feb 12 '12 #1

✓ answered by Dormilich

according to the HTML-DOM there is indeed no click() method on the <a> element (ref.). however, Mozilla states that according to the new HTML5 specification (though I couldn't find that part) there should be and therefore Mozilla supports it. (ref.)
Share this Question
Share on Google+
8 Replies


Dormilich
Expert Mod 5K+
P: 6,604
what does Chrome's Error Console say?
Feb 13 '12 #2

alihaydar
P: 6
it says:
Uncaught TypeError: Object file:///F:/1002/kunye.htm has no method 'click'
Feb 13 '12 #3

Dormilich
Expert Mod 5K+
P: 6,604
Object file:///F:/1002/kunye.htm
that's some strange kind of object ... can you put that page on a public server?
Feb 13 '12 #4

alihaydar
P: 6
sure;

http://kutubhane.com/deneysel/exp/1002/gezinti.htm

it's the second top link from left.. "Künye"
Feb 13 '12 #5

Dormilich
Expert Mod 5K+
P: 6,604
according to the HTML-DOM there is indeed no click() method on the <a> element (ref.). however, Mozilla states that according to the new HTML5 specification (though I couldn't find that part) there should be and therefore Mozilla supports it. (ref.)
Feb 13 '12 #6

alihaydar
P: 6
thank you very much..

is there any other way to call that lightbox without using <a> ?
Feb 13 '12 #7

Dormilich
Expert Mod 5K+
P: 6,604
why don't you bind the lightbox directly to that (calling) element?
Feb 13 '12 #8

alihaydar
P: 6
i don't know how to do that :)
Feb 13 '12 #9

Post your reply

Help answer this question



Didn't find the answer to your JavaScript / Ajax / DHTML question?

You can also browse similar questions: JavaScript / Ajax / DHTML