________________________________
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brian Butterworth
2008/11/4 Aleem B <[EMAIL PROTECTED]>
> I keep thinking of using a bit of "onclick=..." with
an AJAX routine to do the testing and counting. It is a simple matter
of returning a true value to allow the link to activate. I guess if it
broken you could return false...
FWIW, adding an onclick is not the preferred way of
doing this. It's better to attach events to anchors during
document.onload event. If anchors need to be filtered, dom/css classes
can be used.
Sounds interesting, care to share a little more about this
method?
It's called event bubbling - basically you have a piece of JavaScript
that goes through your page, checks (say) all link tags and dynamically
opens them. There's various things you can do - for example, I use:
<a href="..." class="popup">link</a>
to put popup code in, and ditto for things like class="rollover".
That's quite basic stuff, but there's a lot more you can do.
The code itself can get a bit horrible to work with - I wrote my own
bubbling code for quite a while before discovering that there are some
great JavaScript libraries which make this stuff a doddle. I use the
Yahoo! User Interface Library quite a bit - they're released under a BSD
licence, and they have a specific library for event bubbling -
http://developer.yahoo.com/yui/event/
(In true BBC style - other JavaScript libraries are available)