Quirk in Anime-Group-Vote JavaScript [FIXED]

already fixed bugs

Moderator: AniDB

Locked
Elberet
Posts: 778
Joined: Sat Jul 19, 2003 8:14 pm

Quirk in Anime-Group-Vote JavaScript [FIXED]

Post by Elberet »

This is actually more a suggestion then a bug.

Anyway, instead of:
<a href="#" onclick="popup('animedb.pl?show=pop&pop=agvote&id=ID',380,160,0,0,'agvote')">
put:
<a href="animedb.pl?show=pop&pop=agvote&id=ID" onclick="popup('animedb.pl?show=pop&pop=agvote&id=ID',380,160,0,0,'agvote'); return(0);" target="_blank">

This way, browsers that do not understand or were set to ignore JavaScript will open the rating popup page in a new window (target="_blank") and JS-aware browsers will perform the popup JavaScript but ignore the link itself due to the added "return(0);". :)
PetriW
AniDB Staff
Posts: 1522
Joined: Sat May 24, 2003 2:34 pm

Post by PetriW »

Did you test this in several browsers (not just latest ie and ns) to see if it always works as you think it does?
Elberet
Posts: 778
Joined: Sat Jul 19, 2003 8:14 pm

Post by Elberet »

Yup. This behaviour has been implemented since the very first JS implementation in Netscape Navigator. There are, afaik, two browsers (a certain Opera version and some *nix browser I forgot) that do not follow this, but in these cases the deviating behavior is really a bug in the browser. To be really honest, I didn't actually test this, but took this info from a JS resources website I spidered a while ago.
Elberet
Posts: 778
Joined: Sat Jul 19, 2003 8:14 pm

Post by Elberet »

Addendum: If this is too vague, just add the return(0) without changing the link itself. Doing so won't cause problems with broken browsers, but at least those that correctly implement JavaScript will no longer scroll to the top of the page like they do now.
exp
Site Admin
Posts: 2438
Joined: Tue Oct 01, 2002 9:42 pm
Location: Nowhere

Post by exp »

return(0) added.
i did try that once somewhere @ using href= and onclick
but i had problems with some browsers if i remember correctly.
so if someone wants that to be included, plz test it with all
common browsers first :P

BYe!
EXP
Locked