WebAIM - Web Accessibility In Mind

E-mail List Archives

Thread: onSelect vs. onClick

for

Number of posts in this thread: 3 (In chronological order)

From: Ruth Stillman
Date: Wed, Jan 08 2003 10:13AM
Subject: onSelect vs. onClick
No previous message | Next message →

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

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

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

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

Thanks,
Ruth


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


From: Jared Smith
Date: Wed, Jan 08 2003 11:36AM
Subject: Re: onSelect vs. onClick
← Previous message | Next message →

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
Endarterectomy</a>

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/


From: John Foliot - bytown internet
Date: Wed, Jan 08 2003 5:27PM
Subject: RE: onSelect vs. onClick
← Previous message | No next message

with respect to Jared, in XHTML all event handlers are all lowercase,
including "onclick" and "onkeypress". I am not aware of any browser that
does not recognize the all lower-case event handlers, but stand to be
corrected if someone is aware of any issues.

JF

>