RE: Pop-up window<Javascript?>

by "Lauri Vain" <lauri_vain(at)tharapita.com>

 Date:  Wed, 27 Mar 2002 17:06:24 +0200
 To:  "'HWG Basics List'" <hwg-basics(at)hwg.org>
 In-Reply-To:  MyComputer
  todo: View Thread, Original
Hi Tom, 

> > That's no fun! After all -- it isn't hard to write 
> > an onclick() event.
> 
> uh... please forgive me if I'm wrong, but onClick() is 
> an event handler. That's javascript isn't it?

Exactly, onClick() is an event handler and yes, it is Javascript. 

Let's take the following two examples. 
First, the one by Kevin: 
<.A HREF="javascript:Start('definition.html');">Defintion</a>

And now something that Bert and I suggested: 
<.a href="definition.html" target="_blank" onclick="return
Start('definition.html');">Defintion<./a>

Now, what would happen when one has JS enabled in the case of both
examples? Both would open in a new window, agree with me? 

Let's assume that the user now doesn't have JS enabled (for whatever
reason) or uses shift+click (many do). 
1. The first link would open with "javascript:Start('definition.html');"
in the URL bar. Basically, nothing would happen -- dead end. 
2. The second link, however, still opens. True, not in a popup window,
but that usually is not critical (let's not extend our discussion to
where the link absolutely *has* to be a popup). 

It's like that -- when JS is enabled, then everything is great! If it
isn't enabled or doesn't work properly, then nothing bad happens --
people can still use it. So, the benefits of the second solution are
easy to see.

The link <.a href="definition.html" target="_blank" onclick="return
Start('definition.html');">Defintion<./a> works every way and doesn't
require extra work. 

It was *not* my point that JS is bad (It isn't!!! Not even close!). My
point simply is that you shouldn't exclude visitors from the site when
you don't have to do extra work to keep them. It's a great solution to
keep in mind and you'll make some people happy. 

Have a great day! 

:-)

Thanks,
Lauri
--
Tharapita Creations
[server-client web applications]
lauri.vain(at)tharapita.com
Mobile: +372 53 410 610

HTML: hwg-basics mailing list archives, maintained by Webmasters @ IWA