Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Feb 2004
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Assign URL To buttons

    Please Help,
    I have hundreds of HTML pages, each has Prev & Next icons
    (image) to link to the prev/next HTML page. Instead of these
    icons, I want to assign the Left & Right Arrow keys to be bring up
    the Prev/next HTML page.

    Anyone know how to do this?
    In The Name of Love!

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You'll need some Javascript to capture the use of the left and right arrow keys (probably should capture up and down arrow keys as well) and perform the right action when they occur.

    Can you take it from here or do you need help with the javascript?
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #3
    Senior Coder
    Join Date
    Aug 2002
    Location
    Kansas City, Kansas
    Posts
    1,518
    Thanks
    0
    Thanked 2 Times in 2 Posts

  • #4
    New Coder
    Join Date
    Feb 2004
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm still new at javascript, so if you please, add the code taht would make it work for me. Here's my HTML code:

    ============
    <HTML><HEAD></HEAD>
    <BODY>
    <CENTER>

    <A HREF=http://www.ibm.com TARGET=body3><img SRC=http://www.jasonanhkhoa.com/Images/left-arrow-rainbow.gif width=30></a>

    <A HREF=http://www.netscape.com TARGET=body3><img SRC=http://www.jasonanhkhoa.com/Images/ri-arrow-rainbow.gif width=30></a>
    <br>
    <IMG SRC=http://www.jasonanhkhoa.com/Images/Jason/2001/Jason1stMonth/Jason031001_01.jpg></IMG>
    </CENTER>
    </BODY>
    </HTML>
    ============

    I want to have the ibm link page come up when left-arrow-key hit and netscape link page come up when ri-arrow-key hit.
    In The Name of Love!

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <html>
    	<head>
    		<script type="text/javascript">
    			function checkForArrow(evt)
    				{
    				var charCode = (evt) ? evt.which : event.keyCode
    				if (charCode == 37 || charCode == 38) 
    				document.location.href="http://www.ibm.com";
    				if (charCode == 39 || charCode == 40)
    				    document.location.href="http://www.netscape.com";
    				return true;
    				}
    			document.onkeydown = checkForArrow;			
    		</script>
    	</head>
    	<body style="text-align: center;">
    		<a href="http://www.ibm.com" target="body3"><img src="http://www.jasonanhkhoa.com/Images/left-arrow-rainbow.gif" width="30"></a>
    		<a href="http://www.netscape.com" target="body3"><img src="http://www.jasonanhkhoa.com/Images/ri-arrow-rainbow.gif" width="30"></a>
    		<br>
    		<img src="http://www.jasonanhkhoa.com/Images/Jason/2001/Jason1stMonth/Jason031001_01.jpg" />
    	</body>
    </html>
    This code also works for the "up" and "down" arrows. Just from the gist of what I saw while working on this you might want to search this forum for advice on "slide show" scripts. You might find something you'll like better.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #6
    New Coder
    Join Date
    Feb 2004
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you Roy, it's exactly what I want.

    In The Name of Love!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •