By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,446 Members | 2,998 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,446 IT Pros & Developers. It's quick & easy.

Control refuses to get focus

P: 1
Hello all,
I have a few '<input type="text" />' controls on my ASP.NET 2.0 generated page.
Every text-box control has it's specific tab-index.
When I try to move focus to this specific text-box control on this page the focus is shifted to the window element instead of the control itself.
On every other text-box control on the page the focus is received fine.
To apply focus to this element I use the code:
Expand|Select|Wrap|Line Numbers
  1. document.all.elemName.focus();
This is the control itself:
Expand|Select|Wrap|Line Numbers
  1.     <input name       = "ctl00$EditMasterContent$c_carats"
  2.            type       = "text"
  3.            maxlength  = "10"
  4.            id         = "ctl00_EditMasterContent_c_carats"
  5.            tabindex   = "6"
  6.            class      = "textbox1"
  7.            onchange   = "registerOnChangeAction(&quot;caratsChanged&quot;);"
  8.            onkeypress = "javascript:ChkNumberKeyPress(false);"
  9.            onfocus    = "initFocusedElementsVar(this.id);"
  10.            style      = "width: 100px;" />
  11.  
Some other text-box control on the page:
Expand|Select|Wrap|Line Numbers
  1.     <input name       = "ctl00$EditMasterContent$c_stones"
  2.            type       = "text"
  3.            maxlength  = "5"
  4.            id         = "ctl00_EditMasterContent_c_stones"
  5.            tabindex   = "5"
  6.            class      = "textbox1"
  7.            onchange   = "registerOnChangeAction(&quot;stonesChanged&quot;);"
  8.            onkeypress = "javascript:ChkNumberKeyPress(false);"
  9.            onfocus    = "initFocusedElementsVar(this.id);"
  10.            style      = "width: 100px;" />
  11.  
Feb 4 '08 #1
Share this Question
Share on Google+
1 Reply


gits
Expert Mod 5K+
P: 5,333
hi ...

when do you try to set the focus ... onload of the page? could you post an example code that shows the 'flow' of instructions? :)

kind regards
Feb 4 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.