Property. A string beginning with a hash mark (#) that specifies an anchor name in the URL.
1. links[index].hash
2. location.hash
3. areaName.hash
areaName is the value of the NAME attribute of an Area object.
Area object (see Link object), Link object, location object
The hash property specifies a portion of the URL. This property applies to http URLs only.
Setting the hash property navigates to the named anchor without reloading the document. This differs from the way a document is loaded when other location properties are set (see "How documents are loaded when location is set").
See RFC 1738 for complete information about the hash.
See the examples for the Anchor object and the href property.
host, hostname, href, pathname, port, protocol, search properties
Property. A string specifying the height of an image in pixels.
imageName.height
imageName is either the name of an Image object or an element in the images array.
height is a read-only property.
function showImageSize(theImage) {
alert('height=' + theImage.height+
'; width=' + theImage.width +
'; hspace=' + theImage.hspace +
'; vspace=' + theImage.vspace)
}
border, hspace, vspace, width properties
To define a Hidden object, use standard HTML syntax:
<INPUT
TYPE="hidden"
NAME="hiddenName"
[VALUE="textValue"]>
VALUE="textValue" specifies the initial value of the Hidden object.
To use a Hidden object's properties:
1. hiddenName.propertyName
2. formName.elements[index].propertyName
hiddenName is the value of the NAME attribute of a Hidden object.
propertyName is one of the properties listed below.
A Hidden object is a form element and must be defined within a <FORM> tag.
The Hidden object has the following properties:
<HTML>
<HEAD>
<TITLE>Hidden object example</TITLE>
</HEAD>
<BODY>
<B>Click some of these objects, then click the "Display value" button
<BR>to see the value of the last object clicked.</B>
<FORM NAME="form1">
<INPUT TYPE="hidden" NAME="hiddenObject" VALUE="None">
<P>
<INPUT TYPE="button" VALUE="Click me" NAME="button1"
onClick="document.form1.hiddenObject.value=this.value">
<P>
<INPUT TYPE="radio" NAME="musicChoice" VALUE="soul-and-r&b"
onClick="document.form1.hiddenObject.value=this.value"> Soul and R&B
<INPUT TYPE="radio" NAME="musicChoice" VALUE="jazz"
onClick="document.form1.hiddenObject.value=this.value"> Jazz
<INPUT TYPE="radio" NAME="musicChoice" VALUE="classical"
onClick="document.form1.hiddenObject.value=this.value"> Classical
<P>
<SELECT NAME="music_type_single"
onFocus="document.form1.hiddenObject.value=this.options[this.selectedIndex].text">
<OPTION SELECTED> Red <OPTION> Orange <OPTION> Yellow
</SELECT>
<P><INPUT TYPE="button" VALUE="Display hidden value" NAME="button2"
onClick="alert('Last object clicked: ' + document.form1.hiddenObject.value)">
</FORM>
</BODY>
</HTML>
cookie property
Property. An array reflecting all the history entries in a window in source order. See the history object for information.
1. history.propertyName
2. history.methodName(parameters)
3. [windowReference.]history[index]
propertyName is one of the properties listed below.
methodName is one of the methods listed below.
windowReference is a valid way of referring to a window, as described in the window object.
index is an integer representing an entry in the history list.
The history object is a linked list of URLs the user has visited, as shown in the Navigator Go menu.
To change a window's current URL without generating a history entry, you can use the replace method. This replaces the current page with a new one without generating a history entry. See the replace method.
1. history[index]
2. history.length
index is an integer representing an entry in the history list.
To obtain the number of entries in the history list, use
the length property: history.length
.
The history object has the following properties:
The history array has the following properties:
Property | Description |
---|---|
length | Reflects the number of history entries in the window |
The History object has the following methods:
history.go(-3)
window2.history.back()
Example 3. The following example causes the second frame in a frameset to go back one item:
parent.frames[1].history.back()
Example 4. The following example causes the frame named frame1 in a frameset to go back one item:
parent.frame1.history.back()
Example 5. The following example causes the frame named frame2 in window2 to go back one item:
window2.frame2.history.back()
if (history[0].indexOf("NETSCAPE") != -1) {
myFunction(history[0])
}
Example 7. The following example displays the entire history list:
document.writeln("<B>history is</B> " + history)
This code displays output similar to the following:
history is
Welcome to Netscape http://home.netscape.com/
Sun Microsystems http://www.sun.com/
SlugVideo at the Dream Inn http://sapphire.cse.ucsc.edu/SlugVideo/dream-inn.html
Bad Dog Chronicles http://www.supernet.net/~dugbrown/
location object, replace method
Property. A string specifying the server name, subdomain, and domain name.
1. links[index].host
2. location.host
3. areaName.host
areaName is the value of the NAME attribute of an Area object.
Area object (see Link object), Link object, location object
See Section 3.1 of RFC 1738 for complete information about the hostname and port.
See the examples for the href property.
hash, hostname, href, pathname, port, protocol, search properties
1. links[index].hostname
2. location.hostname
3. areaName.hostname
areaName is the value of the NAME attribute of an Area object.
Area object (see Link object), Link object, location object
See Section 3.1 of RFC 1738 for complete information about the hostname.
See the examples for the href property.
hash, host, href, pathname, port, protocol, search properties
Property. A string specifying the entire URL.
1. links[index].href
2. location.href
3. areaName.href
areaName is the value of the NAME attribute of an Area object.
Area object (see Link object), Link object, location object
You can set the href property at any time.
window.location.href="http://home.netscape.com/"
window.location="http://home.netscape.com/"
See RFC 1738 for complete information about the URL.
newWindow=window.open
("http://home.netscape.com/comprod/products/navigator/
version_2.0/script/script_info/objects.html#checkbox_object")
msgWindow.document.write("newWindow.location.href = " +
newWindow.location.href + "<P>")
msgWindow.document.write("newWindow.location.protocol = " +
newWindow.location.protocol + "<P>")
msgWindow.document.write("newWindow.location.host = " +
newWindow.location.host + "<P>")
msgWindow.document.write("newWindow.location.hostName = " +
newWindow.location.hostName + "<P>")
msgWindow.document.write("newWindow.location.port = " +
newWindow.location.port + "<P>")
msgWindow.document.write("newWindow.location.pathname = " +
newWindow.location.pathname + "<P>")
msgWindow.document.write("newWindow.location.hash = " +
newWindow.location.hash + "<P>")
msgWindow.document.write("newWindow.location.search = " +
newWindow.location.search + "<P>")
msgWindow.document.close()
The previous example displays output such as the following:
newWindow.location.href =
http://home.netscape.com/comprod/products/navigator/
version_2.0/script/script_info/objects.html#checkbox_object
newWindow.location.protocol = http:
newWindow.location.host = home.netscape.com
newWindow.location.hostName = home.netscape.com
newWindow.location.port =
newWindow.location.pathname =
/comprod/products/navigator/version_2.0/script/
script_info/objects.html
newWindow.location.hash = #checkbox_object
newWindow.location.search =
hash, host, hostname, pathname, port, protocol, search properties
imageName.hspace
imageName is either the name of an Image object or an element in the images array.
hspace is a read-only property.
See the examples for the height property.
border, height, vspace, width properties
Object. An image on an HTML form.
To define an image, use standard HTML syntax with the addition of JavaScript event handlers:
<IMG
[NAME="imageName"]
SRC="Location"
[LOWSRC="Location"]
[HEIGHT="Pixels"|"Value"%]
[WIDTH="Pixels"|"Value"%]
[HSPACE="Pixels"]
[VSPACE="Pixels"]
[BORDER="Pixels"]
[ALIGN="left"|"right"|
"top"|"absmiddle"|"absbottom"|
"texttop"|"middle"|"baseline"|"bottom"]
[ISMAP]
[USEMAP="#MapName"]
[onAbort="handlerText"]
[onError="handlerText"]
[onLoad="handlerText"]>
ISMAP specifies the image as a server-side image map.
imageName = new Image([width, height])
To use an Image object's properties:
1. imageName.propertyName
2. document.images[index].propertyName
3. formName.elements[index].propertyName
To define an event handler for an Image object created with the Image() constructor:
1. imageName.onabort = handlerFunction
2. imageName.onerror = handlerFunction
3. imageName.onload = handlerFunction
width is the image width, in pixels.
height is the image height, in pixels.
propertyName is one of the properties listed below.
The position and size of an image in a document are set when the document is displayed in Navigator and cannot be changed using JavaScript (the width and height properties are read-only). You can change which image is displayed by setting the src and lowsrc properties. (See the descriptions of src and lowsrc.)
Image objects do not have onClick, onMouseOut, and onMouseOver event handlers. However, if you define an Area object for the image or place the <IMG> tag within a Link object, you can use the Area or Link object's event handlers. See the Link object.
myImage = new Image()
myImage.src = "seaotter.gif"
...
document.images[0].src = myImage.src
1. document.images[index]
2. document.images.length
To obtain the number of images in a document, use the
length property: document.images.length
.
The Image object has the following properties:
Note
The border, hspace, name, and vspace properties are not meaningful for images created with the Image() constructor.
The images array has the following properties:
Property | Description |
---|---|
length | Reflects the number of images in a document |
<IMG NAME="aircraft" SRC="f15e.gif" ALIGN="left" VSPACE="10">
The following code refers to the image:
document.aircraft.src='f15e.gif'
document.myForm.aircraft.src='f15e.gif'
myImage = new Image(70, 50)
myImage.src = "seaotter.gif"
myImage = new Image()
myImage.src = "seaotter.gif"
<SCRIPT>
shirts = new Array()
shirts[0] = "R-S"
shirts[1] = "R-M"
shirts[2] = "R-L"
shirts[3] = "W-S"
shirts[4] = "W-M"
shirts[5] = "W-L"
shirts[6] = "B-S"
shirts[7] = "B-M"
shirts[8] = "B-L"
doneThis = 0
shirtImg = new Array()
// Preload shirt images
for(idx=0; idx < 9; idx++) {
shirtImg[idx] = new Image()
shirtImg[idx].src = "shirt-" + shirts[idx] + ".gif"
}
function changeShirt(form)
{
shirtColor = form.color.options[form.color.selectedIndex].text
shirtSize = form.size.options[form.size.selectedIndex].text
newSrc = "shirt-" + shirtColor.charAt(0) + "-" + shirtSize.charAt(0) + ".gif"
document.shirt.src = newSrc
}
function allShirts()
{
document.shirt.src = shirtImg[doneThis].src
doneThis++
if(doneThis != 9)setTimeout("allShirts()", 500)
else doneThis = 0
return
}
</SCRIPT>
<FONT SIZE=+2><B>Netscape Polo Shirts!</FONT></B>
<TABLE CELLSPACING=20 BORDER=0>
<TR>
<TD><IMG name="shirt" SRC="shirt-W-L.gif"></TD>
<TD>
<FORM>
<B>Color</B>
<SELECT SIZE=3 NAME="color" onChange="changeShirt(this.form)">
<OPTION> Red
<OPTION SELECTED> White
<OPTION> Blue
</SELECT>
<P>
<B>Size</B>
<SELECT SIZE=3 NAME="size" onChange="changeShirt(this.form)">
<OPTION> Small
<OPTION> Medium
<OPTION SELECTED> Large
</SELECT>
<P><INPUT type="button" name="buy" value="Buy This Shirt!"
onClick="allShirts()">
</FORM>
</TD>
</TR>
</TABLE>
<SCRIPT>
delay = 100
imageNum = 1
// Preload animation images
theImages = new Array()
for(i = 1; i < 11; i++) {
theImages[i] = new Image()
theImages[i].src = "image" + i + ".gif"
}
function animate() {
document.animation.src = theImages[imageNum].src
imageNum++
if(imageNum > 10) {
imageNum = 1
}
}
function slower() {
delay+=10
if(delay > 4000) delay = 4000
}
function faster() {
delay-=10
if(delay < 0) delay = 0
}
</SCRIPT>
<BODY BGCOLOR="white">
<IMG NAME="animation" SRC="image1.gif" ALT="[Animation]"
onLoad="setTimeout('animate()', delay)">
<FORM>
<INPUT TYPE="button" Value="Slower" onClick="slower()">
<INPUT TYPE="button" Value="Faster" onClick="faster()">
</FORM>
</BODY>
See also the examples for the onAbort, onError, and onLoad event handlers.
Link object; onClick, onMouseOut, onMouseOver event handlers
Property. An array reflecting all the images in a document in source order. See the Image object for information.
Property. An integer representing the index of an option in a Select object.
1. selectName.options[indexValue].index
2. optionName.index
indexValue is an integer representing an option in a Select object.
optionName is the name of a Select object option created using the Option() constructor.
Option object (see the Select object), options array (see the Select object)
The number identifying the position of the option in the selection, starting from zero.
defaultSelected, selected, selectedIndex properties
stringName.indexOf(searchValue, [fromIndex])
stringName is any string or a property of an existing object.
searchValue is a string or a property of an existing object, representing the value to search for.
If stringName contains an empty string (""), indexOf returns an empty string.
The indexOf method is case sensitive. For example, the following expression returns -1:
"Blue Whale".indexOf("blue")
var anyString="Brave new world"
//Displays 8
document.write("<P>The index of the first w from the beginning is " +
anyString.indexOf("w"))
//Displays 10
document.write("<P>The index of the first w from the end is " +
anyString.lastIndexOf("w"))
//Displays 6
document.write("<P>The index of 'new' from the beginning is " +
anyString.indexOf("new"))
//Displays 6
document.write("<P>The index of 'new' from the end is " +
anyString.lastIndexOf("new"))
myString="brie, pepper jack, cheddar"
myCapString="Brie, Pepper Jack, Cheddar"
document.writeln('myString.indexOf("cheddar") is ' +
myString.indexOf("cheddar"))
document.writeln('<P>myCapString.indexOf("cheddar") is ' +
myCapString.indexOf("cheddar"))
charAt, lastIndexOf, split methods
Function. Evaluates an argument to determine if it is "NaN" (not a number).
isNaN(testValue)
testValue is the value you want to evaluate.
floatValue=parseFloat(toFloat)
if (isNaN(floatValue)) {
notFloat()
} else {
isFloat()
}
NaN property; parseFloat, parseInt functions
Method. Causes a string to be italic, as if it were in an <I> tag.
stringName.italics()
stringName is any string or a property of an existing object.
The following example uses string methods to change the formatting of a string:
var worldString="Hello, world"
document.write(worldString.blink())
document.write("<P>" + worldString.bold())
document.write("<P>" + worldString.italics())
document.write("<P>" + worldString.strike())
The previous example produces the same output as the following HTML:
<BLINK>Hello, world</BLINK>
<P><B>Hello, world</B>
<P><I>Hello, world</I>
<P><STRIKE>Hello, world</STRIKE>
Method. Specifies whether Java is enabled.
navigator.javaEnabled()
The following code executes function1 if Java is enabled; otherwise it executes function2.
if (navigator.javaEnabled()) {
function1()
}
else function2()
appCodeName, appName, userAgent properties
Method. Joins all elements of an array into a string.
arrayName.join(separator)
arrayName is the name of an Array object or a property of an existing object.
The string conversion of all array elements are joined into one string.
a = new Array("Wind","Rain","Fire")
document.write(a.join() +"<BR>")
document.write(a.join(", ") +"<BR>")
document.write(a.join(" + ") +"<BR>")
This code produces the following output:
Wind,Rain,Fire
Wind, Rain, Fire
Wind + Rain + Fire
stringName.lastIndexOf(searchValue, [fromIndex])
stringName is any string or a property of an existing object.
searchValue is a string or a property of an existing object, representing the value to search for.
The lastIndexOf method is case sensitive. For example, the following expression returns -1:
"Blue Whale, Killer Whale".lastIndexOf("blue")
The following example uses indexOf and lastIndexOf to locate values in the string "Brave new world."
var anyString="Brave new world"
//Displays 8
document.write("<P>The index of the first w from the beginning is " +
anyString.indexOf("w"))
//Displays 10
document.write("<P>The index of the first w from the end is " +
anyString.lastIndexOf("w"))
//Displays 6
document.write("<P>The index of 'new' from the beginning is " +
anyString.indexOf("new"))
//Displays 6
document.write("<P>The index of 'new' from the end is " +
anyString.lastIndexOf("new"))
charAt, indexOf, split methods
Property. A string representing the date that a document was last modified.
document.lastModified
lastmod = document.lastModified // get string of last modified date
lastmoddate = Date.parse(lastmod) // convert modified string to date
if(lastmoddate == 0){ // unknown date (or January 1,
// 1970 GMT)
document.writeln("Lastmodified: Unknown")
} else {
document.writeln("LastModified: " + lastmod)
}
lastModified is a read-only property.
document.write("This page updated on " + document.lastModified)
Property. An integer that specifies a length-related feature of the calling object or array.
1. formName.length
2. frameReference.length
3. history.length
4. radioName.length
5. selectName.length
6. stringName.length
7. windowReference.length
8. arrayName.length
When used with array properties:
9. anchors.length
10. applets.length
11. arguments.length
12. elements.length
13. embeds.length
14. forms.length
15. frames.length
16. history.length
17. images.length
18. links.length
19. mimeTypes.length
20. plugins.length
21. plugins[mimeTypeIndex].length
22. selectName.options.length
formName is either the name of a form or an element in the forms array.
stringName is any string or a property of an existing object.
windowReference is a valid way of referring to a window, as described in the window object.
arrayName is the name of an Array object.
The length property is an integer that specifies one of the following:
For all objects except Array objects, length is always a read-only property.
For arrays, you can set the length property to truncate an array at any time. You cannot extend an array; for example, if you set length to 3 when it is currently 2, the array will still contain only 2 elements. For information on other ways to change the length of an array, see the Array object.
function getChoice() {
for (var i = 0; i < document.musicForm.musicType.length; i++) {
if (document.musicForm.musicType.options[i].selected == true) {
return document.musicForm.musicType.options[i].text
}
}
}
The following example displays 8 in an Alert dialog box:
var x="Netscape"
alert("The string length is " + x.length)
if (statesUS.length > 50) {
statesUS.length=50
alert("The U.S. has only 50 states. New length is " + statesUS.length)
}
Method. Creates an HTML hypertext link that requests another URL.
linkText.link(hrefAttribute)
Links created with the link method become elements in the links array. See the Link object for information about the links array.
var hotText="Netscape"
var URL="http://home.netscape.com"
document.write("Click to return to " + hotText.link(URL))
The previous example produces the same output as the following HTML:
Click to return to <A HREF="http://home.netscape.com">Netscape</A>
To define a link, use standard HTML syntax with the addition of JavaScript event handlers:
<A HREF=locationOrURL
[NAME="anchorName"]
[TARGET="windowName"]
[onClick="handlerText"]
[onMouseOut="handlerText"]>
[onMouseOver="handlerText"]>
linkText
</A>
You can also define a link using the link method.
To define an area, use standard HTML syntax with the addition of JavaScript event handlers:
<MAP NAME="mapName">
<AREA
[NAME="areaName"]
COORDS="x1,y1,x2,y2,..."|"x-center,y-center,radius"
HREF="locationOrURL"
[SHAPE="rect"|"poly"|"circle"|"default"]
[TARGET="windowName"]
[onMouseOut="handlerText"]
[onMouseOver="handlerText"]>
</MAP>
HREF=locationOrURL identifies a destination anchor or URL. For areas, any region of an image that does not have an HREF attribute does not function as a hyperlink. For areas, this attribute is required if you include the onMouseOut and onMouseOver event handlers. See the location object for a description of the URL components.
NAME="anchorName" is used only if the link is also an anchor. It specifies a name for the anchor that then becomes an available hypertext target within the current document. See the Anchor object for details.
linkText is the text or HTML source that the user sees as a hypertext link to the URL.
AREA defines an area of an image as an image map.
COORDS specifies the coordinates of the image map.
To use a Link or Area object's properties:
document.links[index].propertyName
propertyName is one of the properties listed below.
Each Link object is a location object and has the same properties as a location object.
For example, when a user clicks the following links, the slower and faster functions execute:
<A HREF="javascript:slower()">Slower</A>
<A HREF="javascript:faster()">Faster</A>
<A HREF="javascript:void(0)">Click here to do nothing</A>
<A HREF="javascript:void(0)">
<IMG SRC="images\globe.gif" ALIGN="top" HEIGHT="50" WIDTH="50">
</A>
Area objects are in the links array. You
cannot refer to an Area object by name; you must use the links
array. For example, if a document contains three Area objects, these
objects are reflected as document.links[0]
,
document.links[1]
, and document.links[2]
. For
information on the links array, see "The links
array".
<MAP NAME="worldMap">
<AREA NAME="topWorld" COORDS="0,0,50,25" HREF="javascript:onTop()"
onMouseOver="self.status='You are on top of the world';return true"
onMouseOut="self.status='You have left the top of the world';return true">
</MAP>
<MAP NAME="worldMap">
<AREA NAME="topWorld" COORDS="0,0,50,25" HREF="javascript:void(0)"
onMouseOver="self.status='You are on top of the world';return true"
onMouseOut="self.status='You have left the top of the world';return true">
</MAP>
1. document.links[index]
2. document.links.length
To obtain the number of links in a document, use the
length property: document.links.length
.
The Area and Link objects have the following properties:
The links array has the following property:
Property | Description |
---|---|
length | Reflects the number of links in a document |
Area objects have the following event handlers:
Link objects have the following event handlers:
Example 1. The following example creates a hypertext link to an anchor named javascript_intro:
<A HREF="#javascript_intro">Introduction to JavaScript</A>
<LI><A HREF=doc3.html#numbers TARGET="window2">Numbers</A>
Example 3. The following example takes the user back x entries in the history list:
<A HREF="javascript:history.go(-1 * x)">Click here</A>
<SCRIPT>
var destHREF="http://home.netscape.com/"
</SCRIPT>
<FORM NAME="form1">
<B>Choose a destination from the following list, then click "Click me" below.</B>
<BR><INPUT TYPE="radio" NAME="destination" VALUE="netscape"
onClick="destHREF='http://home.netscape.com/'"> Netscape home page
<BR><INPUT TYPE="radio" NAME="destination" VALUE="sun"
onClick="destHREF='http://www.sun.com/'"> Sun home page
<BR><INPUT TYPE="radio" NAME="destination" VALUE="rfc1867"
onClick="destHREF='http://www.ics.uci.edu/pub/ietf/html/rfc1867.txt'"> RFC 1867
<P><A HREF=""
onMouseOver="window.status='Click this if you dare!'; return true"
onClick="this.href=destHREF">
<B>Click me</B></A>
</FORM>
function linkGetter() {
msgWindow=window.open("","msg","width=400,height=400")
msgWindow.document.write("links.length is " +
document.links.length + "<BR>")
for (var i = 0; i < document.links.length; i++) {
msgWindow.document.write(document.links[i] + "<BR>")
}
}
<A HREF="http://home.netscape.com">Netscape Home Page</A>
<A HREF="http://www.catalog.com/fwcfc/">China Adoptions</A>
<A HREF="http://www.supernet.net/~dugbrown/">Bad Dog Chronicles</A>
<A HREF="http://www.best.com/~doghouse/homecnt.shtml">Lab Rescue</A>
<P>
<INPUT TYPE="button" VALUE="Display links"
onClick="linkGetter()">
Example 6: Area object with onMouseOver and onMouseOut
event handlers. The following example displays an image,
globe.gif
. The image uses an image map that defines areas for
the top half and the bottom half of the image. The onMouseOver and onMouseOut
event handlers display different status bar messages depending on whether
the mouse passes over or leaves the top half or bottom half of the image.
The HREF attribute is required when using the onMouseOver and onMouseOut
event handlers, but in this example the image does not need a hypertext link,
so the HREF attribute executes javascript:void(0)
, which does
nothing (see "void" for more information).
<MAP NAME="worldMap">
<AREA NAME="topWorld" COORDS="0,0,50,25" HREF="javascript:void(0)"
onMouseOver="self.status='You are on top of the world';return true"
onMouseOut="self.status='You have left the top of the world';return true">
<AREA NAME="bottomWorld" COORDS="0,25,50,50" HREF="javascript:void(0)"
onMouseOver="self.status='You are on the bottom of the world';return true"
onMouseOut="self.status='You have left the bottom of the world';return true">
</MAP>
<IMG SRC="images\globe.gif" ALIGN="top" HEIGHT="50" WIDTH="50" USEMAP="#worldMap">
document.links[0].href
<SCRIPT>
function setBGColor(theColor) {
document.bgColor=theColor
}
</SCRIPT>
Click the color you want for this document's background color
<MAP NAME="colorMap">
<AREA NAME="topColor" COORDS="0,0,50,25" HREF="javascript:setBGColor('antiquewhite')">
<AREA NAME="bottomColor" COORDS="0,25,50,50" HREF="javascript:setBGColor('white')">
</MAP>
<IMG SRC="images\colors.gif" ALIGN="top" HEIGHT="50" WIDTH="50" USEMAP="#colorMap">
Anchor object, Image object; link method
Property. A string specifying the color of the document hyperlinks.
document.linkColor
The linkColor property is expressed as a hexadecimal RGB triplet or as one of the string literals listed in "Color values". This property is the JavaScript reflection of the LINK attribute of the <BODY> tag. The default value of this property is set by the user on the Colors tab of the Preferences dialog box, which is displayed by choosing General Preferences from the Options menu. You cannot set this property after the HTML source has been through layout.
The following example sets the color of document links to aqua using a string literal:
document.linkColor="aqua"
The following example sets the color of document links to aqua using a hexadecimal triplet:
document.linkColor="00FFFF"
alinkColor, bgColor, fgColor, vlinkColor properties
Property. An array of objects corresponding to Area and Link objects in source order. See the Link object for information.
Property. The natural logarithm of two, approximately 0.693.
Math.LN2
Because LN2 is a constant, it is a read-only property of Math.
The following function returns the natural log of two:
function getNatLog2() {
return Math.LN2
}
E, LN10, LOG2E, LOG10E, PI, SQRT1_2, SQRT2 properties
Property. The natural logarithm of 10, approximately 2.302.
Math.LN10
Because LN10 is a constant, it is a read-only property of Math.
The following function returns the natural log of 10:
function getNatLog10() {
return Math.LN10
}
E, LN2, LOG2E, LOG10E, PI, SQRT1_2, SQRT2 properties
Object. Contains information on the current URL.
[windowReference.]location[.propertyName]
[windowReference.]location.methodName(parameters)
windowReference is a variable windowVar from a window definition (see the window object), or one of the synonyms top or parent.
methodName is one of the methods listed below.
The following diagram of a URL shows the relationships between the location properties:
protocol//host:port/pathname#hash?search
http://home.netscape.com/assist/extensions.html#topic1?x=7&y=2
Following is a description of each part of the URL diagram:
See the properties (listed below) for details about the different parts of the URL, or the href property for examples.
The location object has two other properties not shown in the diagram above:
window.location.href="http://home.netscape.com/"
window.location="http://home.netscape.com/"
The view-source: protocol displays HTML code that was generated with JavaScript write and writeln methods. For information on printing and saving generated HTML, see the write method.
The about: protocol provides information on Navigator and has the following syntax:
about:[cache|plugins]
The location object has the following properties:
The location object has the following methods:
window.location.href="http://home.netscape.com/"
window.location="http://home.netscape.com/"
Example 2. The following statement sets the URL of a frame named frame2 to the Sun home page:
parent.frame2.location.href="http://www.sun.com/"
See also the examples for the Anchor object.
history object; URL property
Method. Returns the natural logarithm (base e) of a number.
Math.log(number)
number is any positive numeric expression or a property of an existing object.
The following function returns the natural log of the variable x:
function getLog(x) {
return Math.log(x)
}
Property. The base 2 logarithm of e (approximately 1.442).
Math.LOG2E
Because LOG2E is a constant, it is a read-only property of Math.
The following function returns the base 2 logarithm of E:
function getLog2e() {
return Math.LOG2E
}
E, LN2, LN10, LOG10E, PI, SQRT1_2, SQRT2 properties
Property. The base 10 logarithm of e (approximately 0.434).
Math.LOG10E
Because LOG10E is a constant, it is a read-only property of Math.
The following function returns the base 10 logarithm of E:
function getLog10e() {
return Math.LOG10E
}
E, LN2, LN10, LOG2E, PI, SQRT1_2, SQRT2 properties
imageName.lowsrc
imageName is either the name of an Image object or an element in the images array.
See the examples for the src property.
file: /Techref/language/java/SCRIPT/ref_h-l.htm, 135KB, , updated: 2009/2/2 13:27, local time: 2024/12/11 19:28,
3.145.99.15:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://sxlist.com/TECHREF/language/java/SCRIPT/ref_h-l.htm"> hash </A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to sxlist.com! |
.