Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    Regular Coder
    Join Date
    Jan 2006
    Posts
    243
    Thanks
    14
    Thanked 2 Times in 2 Posts

    controlling cursor focus

    I'm trying to set the cursor focus in a form input type box called "userInput". How can i controll the cursor position?

    I saw a similar thread below, but it's not quite the same and I didn't want to 'break in' as the problem wasn't quite resolved there...

    Thanks.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,920
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    You set the focus on a textbox using the focus() method. But you cannot control or change the position of the cursor within that textbox.

  • #3
    Regular Coder
    Join Date
    Jan 2006
    Posts
    243
    Thanks
    14
    Thanked 2 Times in 2 Posts
    Thanks for the tip, I figured it out and my memory game is pretty much complete!

    Please check it out here and let me know what you think. Any possible improvements?

    This is my first script wich serves an actual purpose, I'm pretty excited I got it to work in a reasonable time. As a sort of continuing scripting excersize I'm planning to add diffrent game modes etc.

    Please let me know to what level you made it!

  • #4
    Banned
    Join Date
    May 2006
    Location
    England
    Posts
    664
    Thanks
    0
    Thanked 84 Times in 84 Posts
    Quote Originally Posted by Kirl
    Thanks for the tip, I figured it out and my memory game is pretty much complete!

    Please check it out here and let me know what you think. Any possible improvements?
    Having it work with the Mozilla series. Forms should not be referred to directly by name.
    The easiest way to bandage what you have already, is to remove "onload=reset()" and at the end of the script insert this:
    Code:
    window.onload=function(){myForm=document.forms.myForm; reset();}

  • #5
    Senior Coder
    Join Date
    Feb 2006
    Location
    USA
    Posts
    1,013
    Thanks
    0
    Thanked 0 Times in 0 Posts
    To add to what Arty Effem said, the object references to the form element are relying on the way that IE automatically adds all elements that have a name or id to the global vars.

    Philip M, in some browsers you can control the cursor position.
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions
    Java != JavaScript && JScript != JavaScript
    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

  • #6
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,920
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Quote Originally Posted by Kravvitz
    Yes, but features that only work in some browsers are useless really. My policy is that if something does not work in IE5.5 (which many people still have) then it is not used. Only more sophisticated users have Mozilla and who apart from a geek has even heard of Opera?

  • #7
    Senior Coder
    Join Date
    Feb 2006
    Location
    USA
    Posts
    1,013
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Umm... it does work in IE5.5.
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions
    Java != JavaScript && JScript != JavaScript
    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

  • #8
    Regular Coder
    Join Date
    Jan 2006
    Posts
    243
    Thanks
    14
    Thanked 2 Times in 2 Posts
    Thank you all for the help and suggestions, I apriciate it!

    I haven't heard any levels though...

    Quote Originally Posted by Philip M
    Only more sophisticated users have Mozilla and who apart from a geek has even heard of Opera?
    Not sure if there are any game enthousiasts here (I'm a Nintendo nut). But Opera will be the standard browser for the new Nintendo system. Because of it's platform independant structure, or so the press release stated.

    Is Opera any good?
    Last edited by Kirl; 06-05-2006 at 09:43 AM.

  • #9
    Banned
    Join Date
    May 2006
    Location
    England
    Posts
    664
    Thanks
    0
    Thanked 84 Times in 84 Posts
    Quote Originally Posted by Kirl
    Thank you all for the help and suggestions, I apriciate it!

    I haven't heard any levels though...


    Not sure if there are any game enthousiasts here (I'm a Nintendo nut). But Opera will be the standard browser for the new Nintendo system. Because of it's platform independant structure, or so the press release stated.

    Is Opera any good?
    It is for JS developers. A popup console with meaningful error messages as standard, plus the ability to specify any code viewer/editor.
    http://www.opera.com/download/


  •  

    Posting Permissions

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