Javacript Focus using Mozilla

Discussion in 'HTML / PHP / JavaScript / CSS' started by smelvincom0, Jul 29, 2005.

  1. For the following example, how could I set focus to this input box (foo) and have the cursor be set to the front of the text value using Mozilla or Firefox. In IE this works fine. But in Mozilla the cursor is set to the end of the value.

    <HTML>
    <head>
    <script language='JavaScript' type='text/javascript'>
    function load() {
    document.forms[0].foo.focus();
    }
    </script>
    </head>

    <form>
    <input type='text' name='foo' value='cheese'>
    </form>
    </body>
    </HTML>

    Mike
    ***
     

Share This Page