javascript - Clicking on google results appends the url many times -
when click on link googleresults - each click appends url, want append url on first click. please how resolve issue
<a href="mailto:googlehelp_r@gmail.com?subject=help%20google-%20results&body=" onclick="this.href+=escape(window.location.href)">googleresults</a>
try this:
<script type="text/javascript"> window.onload=function(){ var lnkmail=document.getelementbyid("mail"); lnkmail.setattribute("href", lnkmail.href + escape(window.location.href) ); } </script> <a id="lnkmail" href="mailto:googlehelp_r@gmail.com?subject=help%20google-%20results&body=">googleresults</a>
it bad practice change href attribute directly on click event, , 1 add inline scripts in markup. ideally, want user know what's going on before clicks on link. then, if chooses disable js, better him have disabled features errors browser.
hope helps :)
Comments
Post a Comment