click on a link with onClick

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alihaydar
    New Member
    • Mar 2007
    • 6

    click on a link with onClick

    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?

    Code:
    <td onClick="document.getElementById('zorba').click()">Knye</td>
    
    <a style="display: none;" href="knye.htm" title="Knye" id="zorba" rel="lightbox">Knye</a>
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    what does Chrome's Error Console say?

    Comment

    • alihaydar
      New Member
      • Mar 2007
      • 6

      #3
      it says:
      Uncaught TypeError: Object file:///F:/1002/kunye.htm has no method 'click'

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        Object file:///F:/1002/kunye.htm
        that's some strange kind of object ... can you put that page on a public server?

        Comment

        • alihaydar
          New Member
          • Mar 2007
          • 6

          #5
          sure;



          it's the second top link from left.. "Künye"

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            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.)

            Comment

            • alihaydar
              New Member
              • Mar 2007
              • 6

              #7
              thank you very much..

              is there any other way to call that lightbox without using <a> ?

              Comment

              • Dormilich
                Recognized Expert Expert
                • Aug 2008
                • 8694

                #8
                why don't you bind the lightbox directly to that (calling) element?

                Comment

                • alihaydar
                  New Member
                  • Mar 2007
                  • 6

                  #9
                  i don't know how to do that :)

                  Comment

                  Working...