[thelist] The definitive, accessible, on the page javascript previous back button

Chris Hayes chris at lwcdial.net
Tue Jan 10 07:35:45 CST 2006


Hello peeps

So I've been asked to do one of those back button thangs
It's more of a command than a request, so my advice to just say use the
browser button is out.

script:    onClick go back a page
            onMouseOver show on window.status
            onMouseOut return the status
noscript: instruct to use the browser back button

My question.. what is the de-facto accessible way to do this?

I'm having some cross browser issues and the <a href="..."> is causing the
browser to do odd things like go  back and then load the href location.

My best javascript so far doesn't use <a>, like this:

  <script language="JavaScript">
   var back_status = window.status;

   function lw_statusOver(){
    window.status='Go back';
    return true;
   }
   function lw_statusOut(){
    window.status=back_status;
    return true;
   }
   document.write('<div style="text-decoration: underline; cursor: pointer;"
onclick="history.back();" onmouseover="lw_statusOver();"
onmouseout="lw_statusOut();">');
   document.write('Previous page');
   document.write('</div>');
  </script>




More information about the thelist mailing list