This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes How to define focus() method in JS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply locked New topic

How to define focus() method in JS

rk sharma
Ranch Hand

Joined: Jun 25, 2011
Posts: 50

I am getting an error "the focus() method undefined"
How to remove this error? please help me
thanks in advance.


Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 29287

There's no input tag for first or last name in that HTML page. This makes document.frm.firstname null so you can't call a method on it.

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
rk sharma
Ranch Hand

Joined: Jun 25, 2011
Posts: 50

There is no problem with the execution of the code. The only problem is my IDE is showing it as a error(undefined function focus()) underlined with red color. As a result each time i used focus() method it is appearing as an error. i just want to remove the warning/error by my IDE(Eclipse).
rk sharma
Ranch Hand

Joined: Jun 25, 2011
Posts: 50

Eric Pascarello

Joined: Nov 08, 2001
Posts: 15376
Looks like your ide is wrong, what a surprise. lol

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60077

Complaining about IDEs here is not useful. Log a bug report with the IDE.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
It is sorta covered in the JavaRanch Style Guide.
subject: How to define focus() method in JS
Similar Threads
JS text in html page
javaScipt onsubmit problem in jsp
Cross browser issues
code not working properly
JavaScript Validation in struts