Re: Attach event/function to links within span tag
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: Attach event/function to links within span tag

From: Norman L. DeForest <af380@chebucto.ns.ca>
Date: Sun Jan 22 2006 - 17:02:54 CET

On 21 Jan 2006, VK wrote:
[snip]
> 4. VAR is not intended for psi-links (thus to execute JavaScript code
> while staying on the same page).
> Sure A is intended for this! :-) Oh wait - we are not misusing it, it's
> really a link on noscript.html plus some little side effect :-)
> <a href="noscript.html" onclick="myFunction();return true;">
>
> Oh common - that's a hypocrisy of the worst kind, really.
[snip]

There is attached semantic meaning ("variable") that may be inappropriate
in some cases. "var" defaults to displaying as italics with my copy of
Firefox. It could be something else with other browsers. (Screen-readers
might use a different voice.)

On the other hand, a typo[0] showed me there's another, albeit invalid,
alternative that doesn't misuse predefined tags:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
<style>
.foo {background:yellow; color:red}
</style>
</head>
<body>
<p>
Just <spam class="foo" onclick="alert('SPAM works!')">Testing</spam>.
</p>
</body>
</html>

&#9786;[1]

[0] Yes, I did mistype "spam" for "span" in one file and then was
    surprised to find out it still worked.
[1] Look it up and then decide how serious I am.

-- 
Norman De Forest      http://www.chebucto.ns.ca/~af380/Profile.html
af380@chebucto.ns.ca   [=||=]  (At the Sign of the Flashing Cursor)
"Oh how I miss the days when it was easier to catch gonorhea than a
computer virus."       -- Big Will in alt.comp.virus, March 9, 2005
Received on Tue Feb 7 21:18:17 2006