HighDots Forums  

Keeping focus help

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss Keeping focus help in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
G
 
Posts: n/a

Default Keeping focus help - 09-13-2007 , 02:47 AM






Hello,

I think I am close to solivng this, however my limited knowledge is
showing...

very simply, I want to keep focus after focus is given...

---------------------------------------------------------------------
<script type="text/javascript">
function keepFocus(WhichField)
{
document.Form1.WhichField.focus();
}
</script>

<form name="form1">

<input type="text" name="Field1" onFocus="keepFocus('Field1')"/>

</form>
---------------------------------------------------------------------

I don't think i'm using the (WhichField) value correctly. Any help
appreciated.

If you want to offer even "more assistance", then ideally, I would not need
to use onFocus="keepFocus('Field1')". In an ideal world, all input and
select controls onFocus would keep focus.

You might think the above situation seems silly, however when using .NET and
AJAX updatepanels, after a postback, the next field you tab into receives
focus and then immediatly looses it. By using a modified and dumbed down
version of the function above, I was able to overcome the problem. However
I have 60+ form fields, and I am really looking for a way for every field
onFocus to keepFocus.

Any help trully appreciated.

Gary.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.