[thelist] Look ma, no tables. Check please?

.jeff jeff at members.evolt.org
Sun Jul 14 18:53:01 CDT 2002


daniel,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Daniel Medley
>
> As far as the java scripting goes I have the links coded
> as such:
> <a class="nav"
>    href="whatever.html" target="_blank"
>    onclick="javascript:openWindow('whatever.html');
>             return false;">whatever.</a>
> I think what this does is, in case the scripting is
> disabled, it will open up a new browser window wich
> all the bells and whistles. This is how it works in
> Mozilla and IE. Am I missing something and it does not
> work as intended sometimes?
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

this does indeed work for javascript and non-javascript users.  however,
your style may cause problems in some browsers -- specifically the
"javascript:" portion of your onclick event handler.  javascript is assumed
to be the language used for event handlers.  so, including it in the event
handler is redundant and unnecessary.

additionally, you're giving yourself more work than necessary.  instead of
hardcoding the link to the document you want to open in your openWindow()
function, use the "this" keyword (which refers to the even handlers calling
object, the <a> tag) with the href property -- openWindow(this.href).  now
you code the link once, where it makes most sense, in the href property.

if you haven't already, give this article a quick read.

Links & JavaScript Living Together in Harmony
http://evolt.org/article/thelist/17/20938/

enjoy,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/





More information about the thelist mailing list