WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: onSelect vs. onClick


From: Jared Smith
Date: Jan 8, 2003 11:36AM

I believe you want onKeyPress instead of onSelect. onSelect is for
text and textarea elements only. onKeyPress triggers when the enter
key is pressed with the link selected.

I think you want both onClick (with CAPITAL C) and onKeyPress, so
you capture both mouse and keyboard activations.

<a href="note-glossary.asp#ce" onClick="NoteWindow('note-glossary.asp#ce','glossary',
375,300);return false;" onKeyPress="NoteWindow('note-glossary.asp#ce','glossary',
375,300);return false;" target="_blank" title="Link opens in new window">Carotid

Jared Smith
WebAIM (Web Accessibility In Mind)
Center for Persons with Disabilities
Utah State University

On Wednesday, January 08, 2003 you sent:
RS> I have some .asp pages that are using JScript to parse the code, and in
RS> implementing popup windows, I am finding that onClick produces the new window
RS> with the size specifications set for the page, whereas onSelect ignores
RS> these. Below is the code for the function as well as the code used to call
RS> the functions.
RS> function NoteWindow(url,name,h,w) {
RS> var new_win;
RS> var features =
RS> 'height=' + h + ',' +
RS> 'width=' + w + ',' +
RS> 'top=' + 10 + ',' +
RS> 'left=' + 10 + ',' +
RS> 'toolbar=' + 0 + ',' +
RS> 'location=' + 0 + ',' +
RS> 'statusbar=' + 0 + ',' +
RS> 'menubar=' + 1 + ',' +
RS> 'resizable=' + 'yes' + ',' +
RS> 'scrollbars=' + 1;
RS> new_win = window.open(url,name,features) ;
RS> new_win.focus();
RS> }

RS> <a href="note-glossary.asp#ce" onclick="NoteWindow('note-glossary.asp#ce','glossary',
RS> 375,300);return false;" target="_blank" title="Link opens in new window">Carotid
RS> Endarterectomy</a>

RS> <a href="note-glossary.asp#cabg" onSelect="NoteWindow('note-glossary.asp#cabg','glossary',
RS> 375,300);return false;" target="_blank" title="Link opens in new window">Coronary
RS> Artery Bypass Graft</a>

RS> I know that in order to make the event device-independent, I should use
RS> onSelect, but does anyone know what needs to be done to make this have the
RS> new window open with the desired dimensions?

RS> Thanks,
RS> Ruth


To subscribe, unsubscribe, or view list archives,
visit http://www.webaim.org/discussion/