Increase usability by highlighting the button of the current section in the navigation bar. This helps the user understand where they are within the structure of your website. In this article you'll learn how to highlight the button of the current section.
Welcome to Bucaro TecHelp!

Welcome to Bucaro TecHelp!
Maintain Your Computer and Use it More Effectively
to Design a Web Site and Make Money on the Web

[About BTH]  [User Agreement]  [Privacy Policy]  [Site Map]  [Contact Form]  [Advertise on BTH]  [News Feed]

Google
Web
This Site

Web Site Menus : Which Section Am I In?

One way to increase the usability of your website is to use a navigation design that web users are familiar with. For example, a navigation bar just below a website's header is a common design used today. Clicking on a button in the navigation bar takes the user to a different web page or different section of the website.

You can increase usability further by highlighting the button of the current section in the navigation bar. This helps the user understand where they are within the structure of your website. In this article you'll learn how to create a navigation bar, and how to use a simple Java Script function to highlight the button of the current section.

Let's design a navigation bar with three buttons: "Home","About", and "Contact". The navigation bar will be constructed using an html table. If you want to get some "hands-on" experience, open your favorite basic ASCII text editor, like Windows Notepad, and type in the html code shown below.

<html>
<head>
</head>
<body>
<table><tr>
<td>Home</td>
<td>About</td>
<td>Contact</td>
</tr></table>

</body>
</html>

This code creates a basic webpage with a table. Save the file with the name "homepage.htm" and then double-click on the filename to open it in your Web browser. Not too impressive? Let's work on it some more. Edit the code to add a link so that it looks as shown below.

<table border=1>
<td><a href="homepage.htm">Home</a></td>

This time when you open the page in your browser, it will look more like a table, and when you click on the home button it will reload the home page. To test the menus, you should create two more webpages, one named "about.htm" and one named "contact.htm". Add links to their respective menu buttons.

Let's work on it some more. Edit the code so that it looks like that shown below. (This shows only the code for the "About" button, but edit all three buttons similarly.)

<td bgcolor="lightblue" width=80>
<a href="about.htm">About</a></td>

Two attributes have been added to the <td> tag, bgcolor to give the button a light blue background, and width to make the button 80 pixels wide. You should specify the same width for each button so that they will all be the same size, giving the navigation bar a more uniform appearance.

So far we have a basic navigation bar, but with html alone we cannot achieve the effect of highlighting the current section's button. We will now use a bit of Java Script code to add that effect. Create a Java Script code block in the head section of your webpage and move the code of the navigation bar into that Java Script code block as shown below.

<html>
<head>

<script language="JavaScript">

<table border=1><tr>
<td bgcolor="lightblue" width=80>
<a href="homepage.htm">Home</a></td>
<td bgcolor="lightblue" width=80>
<a href="about.htm">About</a></td>
<td bgcolor="lightblue" width=80>
<a href="contact.htm">Contact</a></td>
</tr></table>

</script>

</head>
<body>

</body>
</html>

Web Design Sections

RSS Feed RSS Feed

Easy Java Script Code
Easy Slide Show Code
Easy Slide Show Code with Mouseover Pause
Easy Slide Show Code With Linked Slides
Slide Show with Different Size Images
Easy Java Script Timer Code
Easy Java Script Windows
Easy Rollovers
Easy Picture Transition Effects
Easy Moving Popup Code
Easy Picture Zoom Code
Easy Picture Panning Code
Easy Java Script Animation
Easy JavaScript Picture Selector Code
Easy Animated Banners with Java Script
Easy Java Script Form Validation
Easy Drag n Drop Code
Easy Graph Generating Code
Easy Code to Sort a Table by Column
Easy Expanding Menu Code
Web Designer's Reference
Object-Oriented JavaScript
Easy Fading Text Banner Code
Easy Expanding Banner Code
Calendars for Your Website
Date Picker For Your Web Site
Calculators For Your Web Site
Loan Payment Calculator
Length Units Converter
Body Mass Index
Fahrenheit to Celsius Converter
Decimal to Hexidecimal Converter
Easy Code for Screen Tape Adding Machine
Code for Java Script Circle⁄Sphere Calculator
Code for Java Script Cube⁄Box Volume Calculator
Round a Float to 4 Digits to the Right of the Decimal Point
Disable IE8 Accelerators on Your Website
Prevent Automated Form Submissions With Java Script
Make Your Own Graphical Digital Clock
Let Your Web site Visitors Set Font Size
How to Disable the Browser Back Button
Add More Bang to Your Content With Keyword Popup Menus
Put a Music Off Switch on Your Webpage
Java Script Random Password Generator
Password Protection Using the JavaScript Cookie Method
Password Protection Using the Frames Method
Replace Drop-down with Drag-and-drop
Submit Forms Without CGI
Code for a Less annoying Popup Window
Java Script Comparison Operators
Using the Java Script Array Object
Using the Java Script Date Object
Java Script Message Boxes
Java Script Trim Function
Convert Mixed Number to Decimal
How to Shuffle the Deck With Java Script
Web Site Menus : Which Section Am I In?
How Far Did the User Scroll?
Where Did the User Click?
Four Ways to Use Java Script Event Handlers
Create Your Own Database Using Only Notepad : CDV


[Site User Agreement]  [Advertise on This site]  [Search This Site]  [Contact Form]
Copyright©2001-2009 Bucaro TecHelp P.O.Box 18952 Fountain Hills, AZ 85269