Area.pathname

JavaScript 1.1+, JScript 1.0+ Nav3+, IE 3+, Opera3+ Syntax

document.links[num].pathname

Description

The pathname property contains the path of the file specified in the URL, including the leading slash (/). This property is a read/write string.

Example

In Listing 7.16, a sports car picture site is created. The user is instructed to click the type of sports car he or she would like to see. Based on the car selected, the pathname property is modified to direct the link to a different HTML file.

Listing 7.16 Modifying the pathname Property of an Area Object
 <html> <body> <center><h1><u>Sports Car Pictures</u></h1></center> <h3>Step 1: Choose a car.</h3> <form name="question"> <input name="carType" type="radio" checked onClick="updateLinks('LAMBORGINI')">Lamborgini<br> ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.