• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Permission denied...focus

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have JSP which has a HTML form. on load i have put the below mentioned code to set focus in a text field on load. but when i refresh the page in the same IE window, the focus vanishes and there is a permission denied error. what shud i do?

"& lt;" body

on load="document.loginform.username.focus()""& lt;"
[ September 06, 2005: Message edited by: Neeraj Macker ]
 
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
r u using window xp sp2

Thanks
kundan
 
Marshal
Posts: 67340
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kundan varma, JavaRanch is a community of people from all over the world, many of who are not native English speakers. While using abbreviations like "u" instead of spelling out "you" is convenient when text messaging your friends on a cell phone or in a chat room, it presents an extra challenge to those that are already struggling with English. Additionally, such shortcuts may confound automated translation tools that patrons of the Ranch may be making use of.

I would like to ask for your help in making the content of JavaRanch a little easier to read for everybody that visits here by not using such abbreviations.

Please read this for more information.

thanks,
bear
Forum Bartender
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Instead of using the <body> tag onload, you can use the following after the login name text box.

<script>document.forms['FORMNAME'].login.focus()</script>

this will set the focus as the page loads.
 
Bear Bibeault
Marshal
Posts: 67340
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure that that will help the original poster at all, and it's actually rather poor practice.

The onload handler is the best place for any script that needs to execute on page load and that references any elements in the DOM. The DOM is guaranteed to have been loaded by the time that the onload handler executes. Otherwise, you introduce a race condition in which it is possible for the inline script to be executred before the DOM has been compeletely loaded.
 
kundan varma
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear
I am extremely sorry for using such shortcuts but even i dont generally use such abbreviations and also english is not my native language . I was in hurry that time and saw that somebody is having the same problem as me and just asked one question "r u using xp sp2" .
Let me put in this way. I wanted to say "Are you using windows Xtreme Programming service pack 2 ".
Thanks
kundan
 
Bear Bibeault
Marshal
Posts: 67340
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks kundan, I'm sure you understand why we ask that people use real words when posting.
 
Eat that pie! EAT IT! Now read this tiny ad. READ IT!
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!