W3C home > Mailing lists > Public > w3c-wai-gl@w3.org > July to September 2004

Re: Scripting Techniques first draft

From: Tom Wright <developer@tomwright.me.uk>
Date: Wed, 15 Sep 2004 05:09:05 +0100
Message-ID: <4147C061.80201@tomwright.me.uk>
To: w3c-wai-gl@w3.org

Mirabella, Mathew J wrote:

> I am not sure to what extent you should replicate function calls with
> onClick, onKeypress and onActivate, but here they all are.  

onkeypress raises a major problem on Firefox and Opera. When tabbing 
through a document the event will be fired when tabbing off the link, 
hence unexpectedly opening or closing windows!

I don't think we should be promoting onactivate. It is part of the IE 
Dom and poorly supported besides which onclick is device independent in 
most browsers now (Bug 490 - 16.3 of HTML Techniques).

> Now for the close window link...
> In the html of document.html:
> <script language="JavaScript" type="text/javascript">
> <!--
> document.write ('<a href="#" title="Close This Window"
> onClick="window.close();  return false;" onKeyPress="window.close();
> return false;" onActivate="window.close(); return false;">Close This
> Window</a></li>');
> // -->
> </script>

You could supplement this by testing for the presence of an opener 
object before displaying the 'Close Window' link.
ie If a user does not arrive at the page through a pop-up (eg from a 
bookmark) the 'close window' link is not relevant.

if (window.opener) {
   var link = document.createElement('button');
   link.setAttribute('title', 'Close this window');
   link.onclick = function() {
   link.appendChild(document.createTextNode('Close This Window'));

> <noscript>
> Use your browser functions to close this window.
> </noscript>

It should be emphasised that this is only relevant with a Transitional 
DTD. The TARGET attribute is not valid in the Strict Doctype, so, in 
absence of a target and with no scripts enabled the document would open 
in the same window, rendering the above statement misleading.

Cheers, Tom
Received on Wednesday, 15 September 2004 04:09:34 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 16 January 2018 15:33:50 UTC