1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to Control Cursor/Carat Position on Internet Explorer Page Load?

Discussion in 'General Programming Chat' started by B. Friendly, Oct 9, 2012.

  1. B. Friendly

    B. Friendly BANNED BANNED

    Joined:
    Jun 10, 2012
    Messages:
    388
    Likes Received:
    480
    While running a script on IE pages, I've been plagued by the fact that sometimes the cursor "starts" in a different position when an IE page loads. 80% of the time it starts in one place, and can then be controlled, and the other 20% of the time it starts "somewhere else", which screws up mah programmin'.

    I'm currently "upscaling" and this problem is now unacceptably critical.

    I did some initial reading and it appears it's IE's fault, in that somehow it "forgets" where the cursor/carat was previously (which apparently has some effect on where it shows up when a new page is loaded, IDK). It seems to me that the solution is to somehow force the carat "Home" in the same location each and every time a page is loaded, but other than <tab> and <shift+tab> I can't find any keystrokes that will control a cursor/carat within IE.

    I can't be the 1st person with this problem. How are others handling it?

    Thanks in advance.

    BF
     
  2. sockpuppet

    sockpuppet Junior Member

    Joined:
    Nov 7, 2011
    Messages:
    155
    Likes Received:
    145
    you are talking about the blinking cursor inside an input field aka which element has the focus on page load?
    you could use javascript to change the focus:
    Code:
    document.getElementById('input-id').focus()