1. This website uses cookies. By continuing to use this website you are giving consent to cookies being used.
    For information on cookies and how you can disable them visit our Cookie Usage page.
    Dismiss Notice

JavaScript Simple Back and Forward Navigation buttons

Discussion in 'Web Development' started by ishkey, Aug 22, 2008.

  1. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    Just put this script anywhere on your web page and you will give your visitor Back and Forward Navigation buttons. (try increase/decrease goHist value to jump more pages)

    <SCRIPT LANGUAGE="JavaScript">
    <!-- hide this script tag's contents from old browsers
    function goHist(a)
    {
    history.go(a); // Go back one.
    }
    //<!-- done hiding from old browsers -->

    </script>
    <FORM METHOD=
    "post">
    <INPUT TYPE=
    "button" VALUE=" BACK " onClick="goHist(-1)">
    <INPUT TYPE=
    "button" VALUE="FORWARD" onClick="goHist(1)">
    </form>
     
  2. pezboy45

    pezboy45 Mod/Design & Coder [Pro]

    You write that?
     
  3. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    Try this one on a web page and watch the page Slide right off your screen.

    HTML:
     
    <SCRIPT LANGUAGE="JavaScript">
    function WinMove() {
    for (var i = 1; i < 1001; i++)
    window.moveBy(1, 1);
    window.moveBy(-1000, -1000);
    }
    </script>
    <center>
    <form>
    <input type=button value="Go to Cleandeck.net (with a form button)" onClick="WinMove();window.location.href='http://www.cleandeck.net';">
    </form>
    or
    <a href="http://www.cleandeck.net"; onClick="WinMove()">Go to Cleendeck (Using a Link)</a>
    </center>
    
     
  4. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    here's an easy one to print the page. it puts a button on the page, when clicked, it opens the printer selection on the clients pc.

    Code:
     
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    if (window.print) {
    document.write('<form>Click Here To '
    + '<input type=button name=print value="Print" '
    + 'onClick="javascript:window.print()"> This Page!</form>');
    }
    // End -->
    </script>