Closed Bug 289624 Opened 20 years ago Closed 20 years ago

Unable to set focus to a div with javascript.

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
major

Tracking

()

RESOLVED INVALID

People

(Reporter: jhilton, Assigned: bugzilla)

References

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2

Per the w3c standards every html element should have a focus attribute. When
trying to set focus to a div tag with javascript I get a javascript error saying
that focus is not a function for that item.

Error: document.getElementById("div1").focus is not a function
Source File: javascript:document.getElementById("div1").focus();
Line: 1

Reproducible: Always

Steps to Reproduce:
1.create a div with an id
2.using javascript attempt to set focus to that div
3.

Actual Results:  
I got a javascript error:

Error: document.getElementById("div1").focus is not a function
Source File: javascript:document.getElementById("div1").focus();
Line: 1

Expected Results:  
Set focus to that div.
Depends on: 289623
That PDF is incorrect.  focus isn't specified for all HTML elements in neither
DOM level 1 HTML nor DOM level 2 HTML:
http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html.html
http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/

Don't rely on secondary sources.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.