www.webdeveloper.com
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2009
    Location
    San Diego, CA
    Posts
    2

    Script to simulate mouse click on page load?

    I'm wondering if anyone has heard of or come across a script that automates a mouse click on a certain part of the page when it loads. For example, I want the page to load and then automatically have the mouse click in the upper right corner of the screen, about 5px from the top and 5px from the right.

  2. #2
    Join Date
    Oct 2006
    Posts
    93
    What are you trying to click? A button, radio button, ...?

  3. #3
    Join Date
    Jun 2009
    Location
    San Diego, CA
    Posts
    2
    I need it to click inside a certain div area to close a pop up...if that makes sense

  4. #4
    Join Date
    Oct 2006
    Posts
    93
    Hmmm. I've never tried simulating a click on a div.
    Maybe try

    <div id="MyDiv></div>

    document.getElementById('MyDiv').onclick();
    or
    document.getElementById('MyDiv').click();

    but I would be surprised if either worked honestly.

  5. #5
    Join Date
    Oct 2006
    Posts
    93
    or possible....

    <div><a href="javascript:void();" id="MyLink"></a></div>

    document.getElementById('MyLink').onclick();
    or
    document.getElementById('MyLink').click();

    I'm almost certain you can simulate a link click, and since it is inside the div it may simulate clicking there as well.

  6. #6
    Join Date
    Jun 2006
    Posts
    384
    Posting the code would make it lot easier to understand what you're trying to achieve.

Thread Information

Users Browsing this Thread

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

     

Tags for this Thread

Bookmarks

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