host

Property. A string specifying the server name, subdomain, and domain name.

Syntax

server.host

Property of

server

Description

The host property specifies a portion of a URL. The host property is a substring of the hostname property. The hostname property is the concatenation of the host and port properties, separated by a colon. When the port property is 80 (the default), the host property is the same as the hostname property.

host is a read-only property.

See Section 3.1 of RFC 1738 (http://www.cis.ohio-state.edu/htbin/rfc/rfc1738.html) for complete information about the hostname and port.

Examples

See the examples for the server object.

See also

hostname, port, protocol (server object) properties

hostname

Property. A string containing the full hostname of the server, including the server name, subdomain, domain, and port number.

Syntax

server.hostname

Property of

server

Description

The hostname property specifies a portion of a URL. The hostname property is the concatenation of the host and port properties, separated by a colon. When the port property is 80 (the default), the host property is the same as the hostname property.

hostname is a read-only property.

See Section 3.1 of RFC 1738 (http://www.cis.ohio-state.edu/htbin/rfc/rfc1738.html) for complete information about the hostname and port.

Examples

See the examples for the server object.

See also

host, port, protocol (server object) properties

imageX

Property. The horizontal position of the mouse pointer when user clicked the mouse over an image map.

Syntax

request.imageX

Property of

request

Description

The ISMAP attribute of the IMG tag indicates a server-based image map; when the user clicks the mouse when the pointer is over an image map, the horizontal and vertical position of the pointer are returned to the server.

The imageX property returns the horizontal position of the mouse cursor when the user clicks on an image map.

imageX is a read-only property.

Examples

Suppose you define the following image map:

<A HREF="mapchoice.html">
<IMG SRC="images/map.gif" WIDTH=599 WIDTH=424 BORDER=0 ISMAP 
ALT="SANTA CRUZ COUNTY">
</A>
Note the ISMAP attribute that makes the image a clickable map. When the user clicks the mouse on the image, the page mapchoice.html will have properties request.imageX and request.imageY based on the mouse cursor position where the user clicked.

See also

imageY

imageY

Property. The vertical position of the mouse pointer when user clicked the mouse over an image map.

Syntax

request.imageY

Property of

request

Description

The imageY property returns the vertical position of the mouse cursor when the user clicks on an image map.

imageY is a read-only property.

Examples

See example for imageX.

See also

imageX

indexOf

Method. Returns the index within the calling string object of the first occurrence of the specified value, starting the search at fromIndex.

Syntax

stringName.indexOf(searchValue, [fromIndex])

Parameters

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.

fromIndex is the location within the calling string to start the search from. It can be any integer from zero to stringName.length - 1 or a property of an existing object.

Method of

string

Description

Characters in a string are indexed from left to right. The index of the first character is zero, and the index of the last character is stringName.length - 1.

If you do not specify a value for fromIndex, JavaScript assumes zero by default. If searchValue is not found, JavaScript returns -1.

Examples

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"))
In LiveWire, you can display the same values by calling the write function instead of using document.write.

See also

charAt, lastIndexOf methods

inputName

Property. Represents an input element on an HTML form.

Syntax

request.inputName

Parameters

inputName is the value of the name property of an input element on an HTML form.

Property of

request

Description

Each input element in an HTML form corresponds to a property of the request object. The name of each of these properties is the name of the field on the associated form. inputName is a variable that represents the value of the name property of an input field on a submitted form. By default, the value of the JavaScript name property is the same as the HTML NAME attribute.

inputName is a read-only property.

Examples

The following HTML source creates the request.lastName and the request.firstName properties when the idForm is submitted:

<FORM METHOD="post" NAME="idForm" ACTION="hello.html">
<P>Last name:
   <INPUT TYPE="text" NAME="lastName" SIZE="20">
<BR>First name:
   <INPUT TYPE="text" NAME="firstName" SIZE="20">
</FORM>

insertRow

Method. Inserts a row in a database table.

Syntax

cursorName.insertRow("tableName")

Parameters

cursorName is the name of a cursor object.

tableName is the name of a database table.

Method of

cursor object

Description

The insertRow method uses an updatable cursor to insert a row in the specified table. The inserted row follows the current row. See the cursor method for information about creating an updatable cursor.

You can specify values for the row you are inserting as follows:

The insertRow method inserts a null value in any table columns that do not appear in the cursor.

The insertRow method returns a status code based on a database server message to indicate whether the method completed successfully. If successful, the method returns a zero; otherwise, it returns a nonzero integer to indicate the reason it failed. See "Database status codes." for an explanation of status codes.

Examples

In some applications, such as a video-rental application, a husband, wife, and children could all share the same account number but be listed under different names. In this example, a user has just added a name to the accounts table and wants to add a spouse's name to the same account.

customerSet = database.cursor("select * from customer", true)

x=true
while (x) {
   x = customerSet.next() }

customerSet.name = request.theName
customerSet.insertRow("accounts")
customerSet.close()
In the preceding example, the next method navigates to the last row in the table, which contains the most recently added account. The value of theName is passed in by the request object and assigned to the name column in the customerSet cursor. The insertRow method inserts a new row at the end of the table. The value of the name column in the new row is the value of theName. Because the application used the next method to navigate, the value of every other column in the new row is the same as the value in the previous row.

See also

deleteRow, updateRow methods

ip

Property. Provides the IP address of the client.

Syntax

request.ip

Property of

request

Description

The IP address is a set of four numbers between 0 and 255, for example, "198.217.226.34." You can use the IP address to authorize or record access in certain situations.

ip is a read-only property.

Examples

In the following example, the indexOf method evaluates request.ip to determine if it begins with the string "198.217.226.". The if statement executes a different function depending on the result of the indexOf method.

<SERVER>
var ipAddress=request.ip
if (ipAddress.indexOf("198.217.226.")==-1)
   limitedAccess()
else
   fullAccess()
</SERVER>

See also

agent, method, protocol (request object) properties

isNaN

Function. On Unix platforms, evaluates an argument to determine if it is "NaN" (not a number).

Syntax

isNaN(testValue)

Parameters

testValue is the value you want to evaluate.

Description

isNaN is a built-in JavaScript function. It is not a method associated with any object, but is part of the language itself. isNaN is available on Solaris and Irix platforms only.

On platforms that support NaN, the parseFloat and parseInt functions return "NaN" when they evaluate a value that is not a number. The isNaN returns true if passed "NaN," and false otherwise.

Examples

The following example evaluates floatValue to determine if it is a number and then calls a procedure accordingly:

floatValue=parseFloat(toFloat)

if isNaN(floatValue) {
   notFloat()
} else {
   isFloat()
}

See also

parseFloat, parseInt functions

italics

Method. Causes a string to be italic, as if it were in an I tag.

Syntax

stringName.italics()

Parameters

stringName is any string or a property of an existing object.

Method of

string

Description

Use the italics method with the write or writeln methods to format and display a string in a document. In LiveWire, use the write function to display the string.

Examples

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>
In LiveWire, you could generate this HTML by calling the write function instead of using document.write.

See also

blink, bold, strike methods

lastIndexOf

Method. Returns the index within the calling string object of the last occurrence of the specified value. The calling string is searched backward, starting at fromIndex.

Syntax

stringName.lastIndexOf(searchValue, [fromIndex])

Parameters

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.

fromIndex is the location within the calling string to start the search from. It can be any integer from zero to stringName.length - 1 or a property of an existing object.

Method of

string

Description

Characters in a string are indexed from left to right. The index of the first character is zero, and the index of the last character is stringName.length - 1.

If you do not specify a value for fromIndex, JavaScript assumes stringName.length - 1 (the end of the string) by default. If searchValue is not found, JavaScript returns -1.

Examples

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"))
In LiveWire, you can display the same output by calling the write function instead of using document.write.

See also

charAt, indexOf methods

length

Property. An integer that specifies a length-related feature of an object or the arguments array.

Syntax

When used with objects:

1. stringName.length
When used with the arguments array inside a function defintion:

2. arguments.length

Parameters

stringName is any string or a property of an existing object.

Property of

string object, arguments array

Description

The length property is an integer that specifies one of the following:

Examples

The following function returns 8 when you pass it the string "Netscape."

function findLength(x) {
   return x.length
}

link method

Method. Creates an HTML hypertext link that requests another URL.

Syntax

linkText.link(hrefAttribute)

Parameters

linkText is any string or a property of an existing object. This represents the text that will be displayed in the link.

hrefAttribute is any string that specifies the HREF attribute of the A tag; it should be a valid URL (relative or absolute).

Method of

string

Description

Use the link method to programmatically create a hypertext link, and then call write or writeln to display the link in a document. In LiveWire, use the write function to display the string.

Examples

The following example displays the word "Netscape" as a hypertext link that returns the user to the Netscape home page:

var hotText="Netscape"
var URL="http://www.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://www.netscape.com">Netscape</A>
In LiveWire, you can generate this HTML by calling the write function instead of using document.write.

LN2

Property. The natural logarithm of two, approximately 0.693.

Syntax

Math.LN2

Property of

Math

Description

Because LN2 is a constant, it is a read-only property of Math.

Examples

The following function returns the natural log of two:

function getNatLog2() {
   return Math.LN2
}

See also

E, LN10, LOG2E, LOG10E, PI, SQRT1_2, SQRT2 properties

LN10

Property. The natural logarithm of ten, approximately 2.302.

Syntax

Math.LN10

Property of

Math

Description

Because LN10 is a constant, it is a read-only property of Math.

Examples

The following function returns the natural log of ten:

function getNatLog10() {
   return Math.LN10
}

See also

E, LN2, LOG2E, LOG10E, PI, SQRT1_2, SQRT2 properties

lock

Method. Locks the project or server object to prevent other clients from modifying or locking it.

Syntax

1. project.lock()
2. server.lock()

Method of

project, server

Description

You can lock the project or server object to ensure that different clients do not change its properties simultaneously. When an application locks an object, other client requests must wait before they can modify or lock the object.

It is good programming practice to call the unlock method and release an object after calling the lock method. However, LiveWire automatically unlocks an object after the completion of each request to prevent accidental deadlock.

Examples

See Example 2 of the project object for an example of using the lock method.

See also

unlock method

log

Method. Returns the natural logarithm (base e) of a number.

Syntax

Math.log(number)

Parameters

number is any positive numeric expression or a property of an existing object.

Method of

Math

Description

If the value of number is outside the suggested range, the return value is always -1.797693134862316e+308.

Examples

The following function returns the natural log of the variable x:

function getLog(x) {
   return Math.log(x)
}
If you pass getLog the value ten, it returns 2.302585092994046; if you pass it the value zero, it returns -1.797693134862316e+308 because zero is out of range.

See also

exp, pow methods

LOG2E

Property. The base 2 logarithm of e (approximately 1.442).

Syntax

Math.LOG2E

Property of

Math

Description

Because LOG2E is a constant, it is a read-only property of Math.

Examples

The following function returns the base 2 logarithm of E:

function getLog2e() {
   return Math.LOG2E
}

See also

E, LN2, LN10, LOG10E, PI, SQRT1_2, SQRT2 properties

LOG10E

Property. The base 10 logarithm of e (approximately 0.434).

Syntax

Math.LOG10E

Property of

Math

Description

Because LOG10E is a constant, it is a read-only property of Math.

Examples

The following function returns the base 10 logarithm of E:

function getLog10e() {
   return Math.LOG10E
}

See also

E, LN2, LN10, LOG2E, PI, SQRT1_2, SQRT2 properties