|
|||||||
| JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...) |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Can't set focus!
I'm running a very simple function:
function SetFocusForBarCode() { document.getElementById('selDrug').focus(); } Focus does not get set to the control. I've tried using: setTimeout("SetFocusForBarCode",2000); to call it, but no change. Strangely - this works: function SetFocusForBarCode() { document.getElementById('selDrug').focus(); alert('Click the button!'); } Any ideas? |
|
#2
|
||||
|
||||
|
i dont know what the deal is... something shady happens in the browser with the focus with the way you call it. i dont even care to figure out why.
..so i stole a page out of google's home page's HTML. set the focus when the body loads: <body onload="SetFocusForBarCode()"> it works for google, and it'll work for you. |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|