dcsimg
www.webdeveloper.com
Results 1 to 5 of 5

Thread: To simulate a manual click, not an auto one.

  1. #1
    Join Date
    Nov 2005
    Location
    India
    Posts
    336

    To simulate a manual click, not an auto one.

    After all, there is some difference in the way we 'click' using our mouse at some place in the document, and what can be achieved by the dispatchEvent "click" in Firefox.

    We have a page, which has two iFrames on whole. Left frame having a table of clickable email subjects, and right frame showing the entire body of the selected email. The problem is, the clickable area on the subject is too small, making it a pain to click each email to see its body. So I implemented a way of navigating through them using keyboard in the parent page(using key handlers in Javascript). The problem is, when we load the page for first, the navigation works fine, since the focus is on the parent page. But as soon as someone clicks on any area on the two iFrames, the key handlers don't work because they are in the parent page, not in that frame.

    I noticed that when I click on any area outside the two frames, it works again. Idea : "Why not do a setTimeOut or setInterval sort of thing, which just sits and keeps on clicking on a place outside the frames"? Good idea, but doesn't work. Why? Is installing the same kind of key handlers in both the frames the only other way? Even setting focus on an element on the parent page doesn't work. Please help.

    Thanks !

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    You can not simulate a click action (at least not in all the browsers). All you can do is to capture the click event or to trigger a function onclick.

  3. #3
    Join Date
    Nov 2005
    Location
    India
    Posts
    336
    Hi Kor, thanks for your reply. Do you have any other suggestion for the problem I'm facing? Do you think each of my frames would need to have a key handler for the keys?

    I don't care about all the browsers. I just care about Firefox. Is it possible in that?

    Thanks,

  4. #4
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    You should focus() the frames (or the parent, it is not quite clear for me) window whenever you want to. Or, as I said, you may capture the event (on each document) and decide what to do next, accordingly.

  5. #5
    Join Date
    Nov 2005
    Location
    India
    Posts
    336
    Yes, I had tried that already. Setting the focus on the parent window programatically doesn't work either. I just want that the parent window should get the control back from the child frames through a javascript method.

    Catching the onclick event in each frame is one solution, but that will involve a lot of work. I was thinking of a simple solution if possible.

    Thanks a lot for your continuing help!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles