Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Java Basics
|
Java Basics General beginning Java language questions that don't fit in one of the more specific forums. Please specify what version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Basics 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 July 12th, 2006, 04:44 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 198
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Rkn,

You need to run setfocus() when the page loads. For example, <body onLoad="setfocus()">.

Jon Emerson
http://www.jonemerson.net/
 
Old July 12th, 2006, 07:09 AM
rkn rkn is offline
Registered User
 
Join Date: Jul 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nice & simple,
thank you Jon.

Rasmus

 
Old July 13th, 2006, 05:05 PM
Registered User
 
Join Date: Jul 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by dmerrill
 I would like it to go back to "username" after reset is clicked. Thanks for your help!

Dawn

K. Dawn Merrill
Hello,

I am using the exact same script and all the questions I had were answered by you guys. I was trying to figure out how to set focus on the username box, how to use the Enter key to logon, and how to re-set focus to the username box after the Reset button was clicked. I figured out the last one by trial and error. This is what I did and it works:

Here what the code looked like before:

if(imgReset == ""){
 document.write('<input type="reset" value="Reset" name="Reset">');
} else {
 document.write('<input type="image" src="'+imgReset+'" name="Reset" onclick="logon.reset();">');

Here's what did and it works so far:

if(imgReset == ""){
 document.write('<input type="reset" value="Reset" name="Reset" onclick="document.logon.username.focus();">');
} else {
 document.write('<input type="image" src="'+imgReset+'" name="Reset" onclick="logon.reset();">');

Basically I just added the setFocus() function code to the end of that first part. I'm a bigtime rookie so I don't know if what I did is considered normal, but it seems to work and since you guys helped me out I wanted to at least attempt to help you out. Thanks again. I really appreciate it.


 
Old July 14th, 2006, 07:25 PM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 198
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The code onclick="logon.reset();" looks perfect, and it's the same thing I would do. If you wanted more complicated logic for clearing the form, I would put the focus code into a function -- but since you're just doing a one-liner, putting the code directly into the event is the best design.

Jon Emerson
http://www.jonemerson.net/





Similar Threads
Thread Thread Starter Forum Replies Last Post
login script jstewie Javascript How-To 1 July 13th, 2005 12:52 PM
Newbie Help. Login to unique login page per user Kainan Classic ASP Professional 10 May 3rd, 2005 07:47 AM
login failed for user nt authority\anonymous login rj1406 Classic ASP Databases 1 October 24th, 2004 09:15 AM
Login Script natmaster PHP How-To 10 June 19th, 2003 03:50 PM





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