/*
Javascript Essentials
by Jason J. Manger
Publisher: Mcgraw-Hill Osborne Media;
ISBN: 0078822343
*/
<html>
<head>
<script language="JavaScript">
<!--
function validateLink(theLink) {
if (parseInt(theLink) > document.anchors.length)
alert("Sorry, this anchor has not been defined");
else
location.hash = theLink;
}
//-->
</script>
</head>
<body>
<form>
<input type="button"
value="Chapter 1"
onClick="validateLink('0')">
<input type="button"
value="Chapter 2"
onClick="validateLink('1')">
</form>
<a name="0">CHAPTER 1</a>
<!--
Put some more text in here ...
-->
<a name="1">CHAPTER 2</a>
<!--
Put some more text in here...
-->
</body>
</html>
|