mantrid said:
>
Thanks
>You really shouldn't be abusing he side-effect of the javascript:
pseudo-protocol that way, but if you must, you should have the
event handler return false to prevent the page from reloading
each time the link is clicked:
excuse my ignorance but can you clarify this. why is it abuse?
First I need to point out that my advice to add "return false"
was incorrect. I was thinking of something else when I wrote
that. I'm getting old.
The intention of the javascript
: pseudo-protocol is that the
Javascript expression will be evaluated and the resulting HTML
will replace the current contents of the page. What you're
doing is exploiting the side-effect. Your code doesn't return
any HTML, so the current contents are not replaced.
It's abuse because the browser is still expecting to load the
returned contents as a new page. This means that if you make
a little mistake that causes a value to be returned, you're
going to be back here asking why clicking this link replaces
your page with one that contains nothing but the string
"[Object]", or "[Window]", etc, and because certain other
operations cause unpredictable results in some browsers when
the browser thinks that it's about to load new content.
it's about to
--