html - href="javascript:func()" vs href="#" onclick="javascript:func()" -
<a href="javascript:expand()"> , <a href="#" onclick="javascript:expand()"> what's difference?
i know href="#" more standard way nowadays it. problem have standard dropdown menu expands/collapses when user clicks on toggle.
if href="#" code below, whenever clicks on expand page scroll right top isn't acceptable user friendly point.
if use href="javascript:expand()" when user clicks expand, page doesn't move , ok.
so there problems if use href="javascript:expand()" instead? or how fix href="#" page doesn't scroll top whenever user clicks expand.
thanks.
edit: know question may have been asked before, i'm looking @ point of view. im asking suggestion rather explanation.
if javascript onclick event handler returns false, scrolling won't occur. can this:
<a href="#" onclick="expand(); return false;"> if onclick handler not return false, href link followed. in case of href="#", means scroll top of page.
Comments
Post a Comment