hideFocus Property (A, ABBR, ACRONYM, ...)

Switch View :
ScriptFree
HIDEFOCUS Attribute | hideFocus Property

Sets or gets the value that indicates whether the object visibly shows that it has focus.

Syntax

HTML <ELEMENT HIDEFOCUS ... >
Scripting [ bHidden = ] object.hideFocus [ = bHidden ]

Possible Values

bHidden Boolean that specifies or receives one of the following values.
true
Focus is not visibly indicated.
false
Default. Focus is visibly indicated.

The property is read/write. The property has a default value of false.

DHTML expressions can be used in place of the preceding value(s). As of Internet Explorer 8, expressions are supported in IE7 Standards mode and IE5 (Quirks) mode only. For more information, see About Dynamic Properties and Defining Document Compatibility.

Remarks

The focus of an object is visibly indicated by a focus rectangle—a dotted rectangle within the boundaries of the object.

This property does not control the ability of an object to receive focus; for that, use the tabIndex property.

Example

The following example shows how to use the HIDEFOCUS attribute to prevent a focus rectangle from appearing on a button.


...
<BUTTON>
Button With Rectangle</BUTTON>
<BUTTON HIDEFOCUS="true">
Button Without Rectangle</BUTTON>
...

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/hidefocus.htm

Standards Information

There is no public standard that applies to this property.

Applies To

A, ABBR, ACRONYM, ADDRESS, APPLET, AREA, B, BDO, BIG, BLOCKQUOTE, BODY, BUTTON, CAPTION, CENTER, CITE, CUSTOM, DD, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, FRAMESET, hn, HR, I, IFRAME, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, INS, ISINDEX, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MENU, OBJECT, OL, P, PLAINTEXT, PRE, Q, RT, RUBY, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP, Element Constructor
Community Content

i_Cypher
Focus works fine
response to biggerlugs:

The focus rectangle is removed only within the browser context, the OS context will still show whatever focus mechanism is set in the OS Display properties, in your case a blue rectangle.  This attribute works 100% in ie7, and ie8 on systems with no OS display property set for styling focus.

Mr. Raymond Kenneth Petry
unusable - CONTENTEDITABLE
N.B. This property does not indicate the 'inverse-video' of selected text objects in CONTENTEDITABLE.

biggerlugs
Hide focus attribute doesn't fully hide the focus
In the above example, the focus is not fully hidden even on the button with the HideFocus attribute applied to it. When the button with the HideFocus attribute applied receives focus, a blue border is displayed around the button, even though the dotted focus border is not shown. This is under IE8 and the issue occurs irrespective of whether Compatibility View is on or off.