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

Christian Heilmann codepo8 at gmail.com
Tue Jan 10 07:52:55 CST 2006


On 1/10/06, Chris Hayes <chris at lwcdial.net> wrote:
> 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>

I'd use a real DOM script to change the back button message to a link.
This now is inaccessible to users with JavaScript on but using a
keyboard :-)

Actually the most accessible would be a real link with the referrer as
the HREF, quite easy to do with any SSI.


--
Chris Heilmann
Blog: http://www.wait-till-i.com
Writing: http://icant.co.uk/
Binaries: http://www.onlinetools.org/



More information about the thelist mailing list