server.host
server.hostname
stringName.indexOf(searchValue, [fromIndex])
Description
Characters in a string are indexed from left to right. The index of the first character is 0, and the index of the last character is stringName.length - 1.
If you do not specify a value for fromIndex, JavaScript assumes 0 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"))
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
Description
The insertRow method uses an updateable 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 updateable cursor.
You can specify values for the row you are inserting as follows:
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 above 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.
request.ip
<SERVER> var ipAddress=request.ip if (ipAddress.indexOf("198.217.226.")==-1) limitedAccess() else fullAccess() </SERVER>
isNaN(testValue)
floatValue=parseFloat(toFloat) if isNaN(floatValue) { notFloat() } else { isFloat() }
italics
Method. Causes a string to be italicized 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.
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>
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 backwards, 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 0 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 0, 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"))
See also
charAt, indexOf methods
length
Property. An integer that specifies a length-related feature of the calling object or array.
Syntax
When used with objects:
1. formName.length
2. frameReference.length
3. history.length
4. radioName.length
5. selectName.length
6. stringName.length
7. windowReference.length
When used with array properties:
8. anchors.length
9. arguments.length
10. elements.length
11. forms.length
12. frameReference.frames.length
13. windowReference.frames.length
14. links.length
15. selectName.options.length
Parameters
formName is either the name of a form or an element in the forms array.
frameReference is either the value of the NAME attribute of a frame or an element in the frames array.
radioName is either the value of the NAME attribute of a radio object or an element in the elements array.
selectName is either the value of the NAME attribute of a select object or an element in the elements 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.
Property of
Description
The length property is an integer that specifies one of the following:
Examples
In the following example, the getChoice() function uses the length property to iterate over every element in the musicType array. musicType is a select element on the musicForm form.
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)
link method
Method. Creates an HTML hypertext link that jumps to another URL.
Syntax
linkText.link(hrefAttribute)
Parameters
linkText is any string or a property of an existing object.
hrefAttribute is any string or a property of an existing object.
Method of
string
Description
Use the link method with the write or writeln methods to programmatically create and display a hypertext link in a document. Create the link with the link method, then call write or writeln to display the link in a document.
In the syntax, the linkText string represents the literal text that you want the user to see. The hrefAttribute string represents the HREF attribute of the <A> tag, and it should be a valid URL. Each section of a URL contains different information. See the location object for a description of the URL components.
Links created with the link method become elements in the links array. See the link object for information about the links array.
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.open()
document.write("Click to return to " + hotText.link(URL))
document.close()
The previous example produces the same output as the following HTML:
Click to return to <A HREF="http://www.netscape.com">Netscape</A>
See also
anchor object
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 example displays the natural log of 2:
document.write("The natural log of 2 is " + 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 example displays the natural log of 10:
document.write("The natural log of 10 is " + 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 the an object after calling the lock method. However, LiveWire automatically unlocks an object after the completion of each request to prevent an accidental deadlock situation.
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
//Displays the value 2.302585092994046
document.write("The natural log of 10 is " + Math.log(10))
//Displays the value 0
document.write("<P>The natural log of 1 is " + Math.log(1))
//Displays the value -1.797693134862316e+308
//because the argument is out of range
document.write("<P>The natural log of 0 is " + Math.log(0))
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 example displays the base 2 logarithm of E:
document.write("The base 2 logarithm of E is " + 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 example displays the base 10 logarithm of E:
document.write("The base 10 logarithm of E is " + Math.LOG10E)
See also
E, LN2, LN10, LOG2E, PI, SQRT1_2, SQRT2 properties