HTML and CSS Reference
In-Depth Information
Hypertext links embedded in the content of each page are as important
as menus. Although menus are essential in getting visitors to a page with the
information they want, links embedded in content allow the site visitors to
explore a website in a more unstructured way. Embedded links allow the visi-
tors to follow their own thoughts. Also, robots like embedded links because
they add the context information to the current document.
Other forms of navigation can add to a website's usability. hese include
buttons, drop menus, tabs, and imagemaps. Buttons are useful for links lead-
ing to special pages or oferings. Drop menus are handy when you need to
present a long list of linked items but don't want to take up too much page real
estate. Tabs select sections of diferent content that occupy the same space. In
that respect, tabs are not actually hyperlinks, but a mechanism to bring
alternative content sections to the forefront. Imagemaps let you assign links to
deined areas of a graphic. All these techniques require a little extra program-
ming, but they are worth it.
Buttons
he HTML button element creates a button. It is most commonly used as a
control in forms, but with a little scripting, it can also be used to perform
actions anywhere. Buttons can also be deined with the HTML input ele-
ment when its type attribute is "button" . But the input element is self-closing,
whereas the button element is a container that allows content with HTML
markup.
he button element does not have a default action, so to make it a link,
an onclick attribute is needed. he value of the onclick attribute should be a
JavaScript expression that sets, for example, the location of the current docu-
ment. he following code creates a button that, when clicked, takes the visitor
to the page about.html :
<button onclick="location='about.html';"> More Info </button>
Example 5.3 deines three buttons. he irst uses a variation of the preced-
ing button code. he second button calls a JavaScript function, deined in
the page's head section, to pick a random URL. he third button does noth-
ing, because it has a disabled attribute set to "disabled" . If that button were
enabled, clicking it would close the active page.
 
Search WWH ::




Custom Search