Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 17th, 2004, 02:20 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Firstly I would advise to put anything more than a small snippet of code into a function, it's easier to read, maintain and re-use.
Code:
function focusOnElement(FormName, ElementName)
{
  var oElement = document.forms[FormName].elements[ElementName];
  if (oElement && oElement.focus)
  {
    oElement.focus();
  }
}
You can now use this to focus on any element where it will accept it:
Code:
<input onclick="document.nemoName.submit();" onblur="focusOnElement('nemoName', 'nemonico');" type="button"  tabindex="2"  value="Aceptar">
You don't need the script block following the button.

--

Joe
 
Old September 20th, 2004, 03:01 AM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much!!!!


 
Old September 24th, 2004, 05:49 AM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much. I have got it to work!!!






Similar Threads
Thread Thread Starter Forum Replies Last Post
IE 7 form select options harpua HTML Code Clinic 0 May 9th, 2007 11:59 PM
Select form name lic023 Access VBA 1 February 12th, 2007 12:44 PM
Is it possible to select record in continous form chiefouko Access VBA 0 July 18th, 2006 04:20 AM
File select on a form Korvath Access 2 February 7th, 2005 11:22 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.