I think what you're looking for is this:
<a href="http://www.google.com"
onclick="window.location=this.href;">Go to Google</a>
This ensures that folks without JS enabled still get a functioning
link (the browser simply ignores the onclick) and folks with JS
enabled get the fancy JS version... But why? If you're duplicating
the behavior of a link in JS and there's no added benefit, what's the
point?
We'll ignore that though and assume you've got a good reason for
duplicating a links innate behavior... to make the above example work
in your format (with the redirect function), you can use your function
almost verbatim:
function redirect(URL) {
window.location = URL;
}
and call it as so:
<a href="http://www.google.com" onclick="redirect(this.href);">Go to Google</a>
Just FYI: the "javascript:" pseudo-protocol should only be used when
called from within an HREF attribute. And, 95% of the time, you don't
want to call a function or method from an HREF anyway. the
pseudo-protocol is definitely *not* necessary from within an event
handler such as "onclick", nor should it be followed by "//" as in
"javascript://" when it is actually used.
HTH,
Stephen
____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
Send Your Posts To: [email protected]
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk
________________ http://www.wdvl.com _______________________
You are currently subscribed to wdvltalk as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016
Please include the email address which you have been contacted with.