Java Scrip Reference
An
anchor is an area in a document where the visitor can be taken after clicking on
a
link. An example of an anchor would be the link you may have used in the
JavaScript Object table
example: <A NAME="anchorname"> and the link to that
section of the page would be
<A HREF="#anchorname">
Properties:
The length Property
This property returns a number equal to the length of the specified array or object.
example: LENGTH=js.length
Methods: None
Object Name: button
The button object is used in forms to define a button. Name specifies the button's name, and value specifies the text on the face of the button. Buttons must be defined within the <FORM> and </FORM> tags.
An example of a button
example:
<INPUT TYPE="button" name="Name" value="value">This property displays the name of the specified object.
example:
Name=object.name
Property of: button, checkbox, frame, hidden, password, radio, reset, select, submit,
The
value PropertyThis property displays the value of the specified object
example:
VALUE=document.form.object.value
Where VALUE is the variable that you want to
assign the responses to, form is the
name of the form the object is in, and object
is an object from the list below.
Property of: button, checkbox, hidden, password, radio, reset, select, submit, and
text
Methods:
click() Simulates a mouse click
on a button
example: nameofbutton.click()
Object Name: checkbox
A checkbox is one of those square boxes you can click on and off that i'm sure everyone has seen before. Checkboxes must be defined within the <FORM> and </FORM> tags.
example: <INPUT TYPE="checkbox"
name="Name" value="value">
'checked' can also be added to the code to make the
box checked when the page is loaded.
Properties:
The name Property
This property displays the name of the specified object.
example:
Name=object.name
Property of: button, checkbox, frame, hidden, password, radio, reset, select,
submit, text, textarea, and window
The value Property
This property displays the value of the specified object
example:
VALUE=document.form.object.value
Where VALUE is the variable that you want to
assign the responses to, form is the
name of the form the object is in, and object
is an object from the list below.
Property of: button, checkbox, hidden, password, radio, reset, select, submit, and
text
The checked Property
This property returns either a True or False which indicates if a specific checkbox
or
radio button is checked.
example: var=checkbox.checked
Where
var is the variable you want to assign the response to and checkbox is the
name
of the checkbox or radio button.
Property of: checkbox, and radio
The defaultChecked Property
This property returns either a True or False which indicates the default selection
status
of a radio button or checkbox.
example: var=checkbox.defaultChecked
Where
var is the variable you want to assign the response to and checkbox is
the
name of the checkbox or radio button.
Property of: checkbox, and radio
Methods:
click() - Simulates a mouse click on a
button
example: nameofbutton.click()
Object Name: date
The date object is a very useful and sophisticated function. It allows you work with dates and time. Anything from years, days, hours, minutes, seconds, etc. JavaScript stores dates as the number of miliseconds that have elapsed since January 1, 1970, 00:00:00.
examples:
1. variable = new Date()
2. variable = new Date(hours, minutes, seconds)
3. variable = new Date(year, month, day)
The first example returns the current date.
The second example returns the current hour,
minute, and second.
The third example returns the current year, month,
and day.
Properties: None
Methods:
getDate()
- Reads the day of the month for the defined date
example: birthday=birthday.getDate()
getDay()
- Reads a number representing the day of the week for the defined date
example:
weekday=birthday.getDay()
getHours()
- Reads the hour of the defined date.
example:
hour=birthday.getHours()
getMinutes()
- Reads the minutes of the defined date
example: minutes=birthday.getMinutes()
getMonth()
- Reads the month for the defined date
example:
month=birthday.getMonth()
getSeconds() - Reads the seconds for the current time
example: seconds=birthday.getSeconds()
getTime() - Reads the numeric value for the time of the
defined date
example: time=birthday.getTime()
getTimeZoneOffset() - Reads the timezone offset in minutes for the current location
example: offset=birthday.getTimeZoneOffset()
getYear()
- Reads the year for the defined date
example: year=birthday.getYear()
parse() - Reads the number of
milliseconds since 1/1/70 00:00:00
example: timesince=parse(DateToparse)
setDate()
- Sets the day of the month for the defined date
example: birthday.setDay(01)
setHours() - Sets the hours for the defined date
example: birthday.setHours(16)
setMinutes() - Sets the minutes for the defined date
example: birthday.setMinutes(25)
setMonth() - Sets the month for a defined date
example: birthday.setMonth(03)
setSeconds()-Sets the seconds for the defined date
example: birthday.setSeconds(24)
setTime() - Sets a variable to the value of the
number of milliseconds since 1/1/70
example: birthday.setTime(milliseconds)
setYear() - Sets the year for the defined date
example: birthday.setYear(1982)
toGMTString() - Converts a date to a string using toGMTString
example: birthdayGMT=birthday.toGMTString()
toLocaleString()
- Converts a date to a string using the current toLocaleString
example: birthdayLocale=birthday.toLocaleString()
UTC()
- Displays the number of milliseconds in a date since 1/1/70 00:00:00, GMT
example: birthmilli=birthday.UTC()()
Object Name: document
The document is perhaps the single most important JavaScript function there is. It contains information on the current page, and provides ways of displaying HTML output to the viewer.
example: document.property or document.method
where property and method are something from the
lists below.
Properties:
The alinkColor Property
The alinkColor property sets the color of an active link on a webpage.
example: document.alinkColor="color"
Where
color is either the name of the color or the hexadecimal value.
The bgColor Property
This property specifies the webpage's background color.
example: document.bgColor="color"
Where
color is either the name of the color or the hexadecimal value.
The cookie Property
Using this property returns the contents of cookies.
example: ck=document.cookie
Where
ck is the variable you want to assign the response to.
The fgColor Property
This property sets the webpage's text color.
example: document.fgColor="color"
Where
color is either the color name or the hexadecimal value of the color.
The lastModified Property
Using this property returns a string that displays when the current page was last
modified.
example: document.lastModified
The linkColor Property
This property controls the link color of a webpage.
example: document.linkColor="color"
Where
color is either the name of the color or a hexadecimal value representing the
color.
The location Property
This property displays the entire current URL.
example: CL=document.location
Where
CL is the variable that you want to assign the response to.
The title Property
This property sets the title of the webpage.
example: document.title="MyTitle"
Where
MyTitle is the title you want for the webpage.
The vlinkColor Property
This property defines the color of visited links in a webpage.
example: document.vlinkColor="COLOR"
Where
COLOR is either the name of the color or a hexadecimal value which
represents the color.
Methods:
clear() - Clears the document
example: document.clear()
close() - Closes the document
example: document.close()
open() - Opens the specified MIME type
example: document.open({"mime"})
write() - Writes text to the document
example: document.write("text")
writeln() - Writes text to the document and adds a carriage
return that is ignored by
HTML, so writeln() and write() are the same.
example:
document.writeln("text")
Object Name: elements array
Accesses an array of objects in a form such as checkboxes, buttons, fields, etc. In the order that they appear. Remember, the first object in a form is always number 0. Not number 1.
Syntax: formname.elements[i] where i is the number of the object, and formname.elements.length
Properties:
The length Property
This property returns a number equal to the length of the specified array or object.
example: LENGTH=js.length
Object Name: form
The form object is used to create a form. Forms can contain fields, text areas, buttons, checkboxes, etc. All used for inputting data.
example: <FORM NAME="name" TARGET="target" ACTION="file" METHOD="POST/GET" ENCTYPE="encodingtype">
NAME defines the name of the form
TARGET defines the window that form results go to
ACTION defines where the form responses should be
sent for processing. It can be a CGI script, an email address, almost anything.
METHOD can be either POST or GET. It defines how
the form responses are sent to the server.
ENCTYPE defines the MIME data encoding type for the
form.
Properties:
The action Property
The
action property sets the destination URL for data that is
sent
from a form.
example: form.action="Actiontotake"
Where
form is the name of the form and Actiontotake is the URL where the data
should
be sent.
The encoding Property
This property pertains to a string that represents the type of MIME encoding used
for a
form.
example: EncodingType=form.encoding
Where
EncodingType is the variable that you want the response assigned to.
The length Property
This property returns a number equal to the length of the specified array or object.
The method Property
This property tells the viewer's browser how to send field input from forms to the
server.
example: form.method
The target Property
This property tells the browser where to send form responses when using a form,
and it
tells the browser where to open pages when using links.
example: form.target="TARGET"
Where
TARGET is the name of the window.
Property of: form, link, and location
Methods:
Object Name: frame
The frame object is used to define frames. Frames are becoming increasingly popular on the internet. They offer increased navigability and faster load times.
example: <FRAMESET ROWS="ROWS" COLS="COLS"> <FRAME SRC="file" NAME="name"> </FRAMESET>
COLS specifies the width of the columns. Can be
either two values seperated by a comma, or a percent of the screen.
ROWS speicifes the width of the rows. Can be either
two values seperated by a comma, or a percent of the screen.
For each frame you want, you have to specify the
file and name of the frame using the <FRAME> tag.
SRC tells the browser the name of the file that
should be displayed in the frame.
NAME gives the frame a name.
Properties:
The name Property
This property displays the name of the specified object.
example: Name=object.name
Property of: button, checkbox, frame, hidden, password, radio, reset, select, submit,
The length Property
This property returns a number equal to the length of the specified array or object.
example: LENGTH=js.length
Property of: anchor, elements, form, frame, history, link, radio, select, and window
The parent Property
This property is a synonym for a window that contains the current frame.
example: Window=frame.parent
Where
Window is the variable that you want to assign the response to.
Property of:
frame, and window
The pathname Property
Returns a string specifying the url-path protion of the URL.
example: Path=link.pathname
Where
Path is the variable that you want to assign the response to.
Property of: frame, and window
Methods:
clearTimeout()
- Clears the setTimeout command
example: NameOfFrame.clearTimeout(TimerIDVariable)
setTimeout()
- Runs JavaScript code for a certain number of milliseconds
example: NameOfFrame.setTimeout("String",msecs)
Object Name: hidden
The hidden object is used in forms to hide a text input field from the viewer. The field is still there, but cannot be accessed or seen. Useful for adding pre-defined data to forms. As with all other form related objects, a hidden field must be defined inside the <FORM> and </FORM> tags.
example: <INPUT TYPE="hidden"
NAME="name" VALUE="value">
Where NAME is the name of the field, and VALUE is
the data in the field.
Properties:
The name Property
This property displays the name of the specified object.
example:
Name=object.name
Property of: button, checkbox, frame, hidden, password, radio, reset, select,
submit, text, textarea, and window
The value Property
This property displays the value of the specified object
example: VALUE=document.form.object.value
Where VALUE is the variable that you
want to assign the responses to, form is
the name of the form the object is in, and object
is an object from the list below.
Property of: button, checkbox, hidden, password, radio, reset, select, submit, and
text
The defaultValue Property
This
property sets a string as the default value for a password, text, textarea, or
hidden
field.
example: Field.defaultValue="Text"
Where
Field is the name of the field, and Text is the value you want to set it to.
Property of: hidden, password, text, and textarea
Methods: None
Object Name: history
The history object holds information about the viewer's browser session. Data consists of number of sites visited, their URLs, and their names. This object is especially useful for making JavaScript based navigation systems.
example: history.property or history.method
where property or method is one from the list
below.
Properties:
The length Property
This property returns a number equal to the length of the specified array or object.
Syntax:
LENGTH=js.length
Property of: anchor, elements, form, frame, history, link, radio, select, and window
back() -
Loads the previous URL from the history file
example: history.back
forward() - Loads the next URL in the history file
example:
history.forward
go() - Loads a
URL from the histroy list, num is an integer representing a
page number
example:
history.go(num | "URL")
Object Name: link
The link objects creates HTML hyperlinks using JavaScript.
example: <HREF="location" NAME="name"
TARGET="target">
Where HREF is the URL of the file to go to when the
link is clicked, MAME is the name of the link, and TARGET is the area name that you want
the link to be displayed in. TARGET is only applicable when using links in frames or
multiple windows.
Properties:
The hash Property
Using this property returns a string that begins with a has mark (#) and represents
the
anchor name that the viewer is currently at in the document.
example: Anchor=link.hash
Where
Anchor is the value that you want to assign the responses to.
Property of: link, and location
The host Property
Using this property returns the host:port section of the URL, which tells you the
host
name.
example: Hostname=link.host
Where
Hostname is the variable that you want to assign the responses to.
Property of: link, and location
The hostname Property
This property returns the domain name or IP address of the referenced host.
example: Host=location.hostname
Where
Host is the variable that you want to assign the response to.
Property of: link, and location
The href Property
Using this property returns a string equal to the whole referenced URL.
example: var=link.href
Where
var is the variable that you want to assign the response to.
Property of: link, and location
The length Property
This property returns a number equal to the length of the specified array or object.
This property displays the communications port of the server.
example: commport=link.port
Where
commport is the variable that you want to assign the response to.
Property of: link, and location
The protocol Property
This property displays the protocol of the current page (HTTP,FTP, etc.)
example: proto=link.protocol
Where
proto is the variable that you want to assign the response to.
Property of: link, and location
The referrer Property
This property returns the calling URL. Usually the page that the viewer came from.
example: document.referrer
The search Property
This property displays a string that begins with a question mark and represents the
search query in a specified URL.
example: URLSearch=link.search
Where URLSearch is the variable that you want to assign the response to.
Property of: link, and location
The target Property
This property tells the browser where to send form responses when using a form,
and
it tells the browser where to open pages when using links.
example: form.target="TARGET"
Where TARGET is the name of the window.
Property of: form, link, and location
Methods: None
Object Name: location
The location object holds information about the current URL. Each property of the location object pertains to a different part of the URL.
example: window.location.property
Where window is the current window or the window
you want to use it with and property is a property from the list below.
Properties:
The hash Property
Using this property returns a string that begins with a has mark (#) and represents
the
anchor name that the viewer is currently at in the document.
example: Anchor=link.hash
Where Anchor is the value that you want to assign the responses to.
Property of: link, and location
The host Property
Using this property returns the host:port section of the URL, which tells you the host
name.
example: Hostname=link.host
Where Hostname is the variable that you want to assign the responses to.
Property of: link, and location
The hostname Property
This property returns the domain name or IP address of the referenced host.
example: Host=location.hostname
Where Host is the variable that you want to assign the response to.
Property of: link, and location
The href Property
Using this property returns a string equal to the whole referenced URL.
example: var=link.href
Where var is the variable that you want to assign the response to.
Property of: link, and location
The port Property
This
property displays the communications port of the server.
example: commport=link.port
Where commport is the variable that you want to assign the response to.
Property of: link, and location
The protocol Property
This property displays the protocol of the current page (HTTP,FTP, etc.)
example: proto=link.protocol
Where proto is the variable that you want to assign the response to.
Property of: link, and location
The search Property
This property displays a string that begins with a question mark and represents the
search query in a specified URL.
example: URLSearch=link.search
Where URLSearch is the variable that you want to assign the response to.
Property of: link, and location
The target Property
This property tells the browser where to send form responses when using a form,
and
it tells the browser where to open pages when using links.
example: form.target="TARGET"
Where TARGET is the name of the window.
Property of: form, link, and location
Methods: None
Object Name: math
An object that has math values stored as properties and methods. Certain math functions that you take for granted on a calculator such as the value of Pi are stored here.
example: Math.property or Math.method
where property or method are one from the list
below.
Properties:
The E Property
This property returns Euler's constant, which is the base of natural logarithms, and
is
aproximately equal to 2.718.
example: Euler=Math.E
Where Euler is the variable that you want to assign the reponse to.
The LN2 Property
This value displays the natural logarithim of two, which is aproximately 0.693.
example: Log=Math.LN2
Where Log is the variable that you want to assign the response to.
The LN10 Property
This value returns the natural logarithim of ten, which is aproximately 2.302.
example: Log=Math.LN10
Where Log is the variable that you want to assign the response to.
The LOG2E Property
This property returns the base two logarithim of e, which is aproximately 1.442.
example: Log=Math.LOG2E
Where Log is the variable that you want to assign the response to.
The LOG10E Property
This property returns the base ten logarithim of e, which is aproximately 0.434.
example: Log=Math.LOG10E
Where Log is the variable that you want to assign the response to.
The PI Property
This property returns the value of Pi, aproximately 3.14159.
example: valueofpi=Math.PI
Where valueofpi is the variable that you want to assign the respone to.
The SQRT1_2 Property
This property displays the square root of one half, which is aproximately 0.707.
example: Math.SQRT1_2
The sqrt2 Property
This property displays the square root of two, which is aproximately 1.414.
example: Math.sqrt2
Methods:
abs()
- Displays the absolute value of a number
example: Math.abs(number)
acos()
- Displays the arc cosine of a number
example: Math.acos(number)
asin()
- Displays the arc sine of a number
example: Math.asin(number)
atan()
- Displays the arc tangent of a number
example: Math.atan(number)
ceil()
- Displays the least integer greater than or equal to a number
example: Math.ceil(number)
cos()
- Displays the cosine of a number
example: Math.cos(number)
exp()
- Displays eNumber where Number is the argument and e is Euler's constant
example: Math.exp(number)
floor()
- Displays the greatest integer less than or equal to a number
example: Math.floor(number)
log()
- Displays the natural logarithim of a number
example: Math.log(number)
max()
- Displays the greater of two numbers
example: Math.max(number1,number2)
min()
- Displays the lesser of two numbers
example: Math.min(number1,number2)
pow()
- Displays base to the exponent power, baseExponent
example: Math.pow(baseExponent)
random()
- Displays a random number between 0 and 1. UNIX ONLY platforms
example: Math.random
round()
- Displays the number rounded to the nearest integer
example: Math.round(number)
sin()
- Displays the sine of a number
example: Math.sin(number)
sqrt()
- Displays the square root of a number
example: Math.sqrt(number)
tan()
- Displays the tangent of a number
example: Math.tan(number)
Object Name: navigator
Ever wanted to really scare someone and make them think that you know everything about them? If you use JavaScript to do it, you'll probably need to use the navigator object. This object contains all the information about the browser the user is using to view a webpage.
example: navigator.property
Where property is one from the list below.
Properties:
The appCodeName
Property
Reading this property returns the codename of the current
browser that the viewer is using.
example: Name=navigator.appCodeName
Where Name is the variable you want to assign the value to.
The appName Property
Reading this property returns the name of the current browser
that
the viewer is using.
example: Name=navigator.appCodeName
Where Name is the variable you want to assign the value to.
The appVersion Property
Reading this property returns the verison number of the current
browser that the viewer is using.
example: Ver=navigator.appVersion
Where Ver is the variable that you want to assign the value to.
The userAgent Property
This property returns the user-agent header in the HTTP protocol from client to
server.
example: UAgent=navigator.userAgent
Where UAgent is the variable that you want to assign the response to.
Methods: None
Object Name: password
The password object creates a text input field that replaces all the text entered into it with asterisks, thus hiding what is entered from any prying eyes. Buttons have to be defined within the
<FORM> and </FORM> tags.example: <INPUT TYPE="PASSWORD" NAME="NAME"
VALUE="VALUE" SIZE="SIZE">
NAME Specifies the name of the field.
VALUE Specifies the text that is already in the
box when the page loads.
SIZE Speicifies the width of the field (Or how
many characters a user can enter before the field starts to scroll.)
Or, in JavaScript, to access the properties and
methods, use:
password.method or password.property where
password is the name of the password field and method or property is one from the list
below.
Properties:
The name Property
This property displays the name of the specified object.
example:
Name=object.name
The defaultValue Property
This property sets a string as the default value for a password, text, textarea,
or
hidden field.
example: Field.defaultValue="Text"
Where Field is the name of the field, and Text is the value you want to set it to.
Property of: hidden, password, text, and textarea
The value Property
This property displays the value of the specified object
example: VALUE=document.form.object.value
Where VALUE is the variable that you want to assign the responses to, form is
the
name of the form the object is in, and object is an object from the list below.
Property of: button, checkbox, hidden, password, radio, reset,
select, submit, and text
Methods:
blur()
- Removes the focus from the defined element
example: passName.blur()
focus() - Places the focus on the assigned element
example: selectName.focus(),
select() -
Selects the input area of the defined element
example: passName.select()
Object Name: radio
Radio buttons, as with all other form objects, have to be defined within the
<FORM> and </FORM> tags.Where
NAME is the name of the button, VALUE is the value of the button, and CHECKED can either
be part of the code or not. If you put CHECKED, then when the form loads, the button is
already checked. Otherwise, the user has to click it. If you want to access the properties and methods, use radio.property or
radio.method Where property or method are from the list below and radio is the name of the
radio button.
Properties:
The name Property
This property displays the name of the specified object.
example:
Name=object.name
The checked Property
This property returns either a True or False which indicates if a specific checkbox
or
radio button is checked.
example: var=checkbox.checked
Where var is the variable you want to assign the response to and checkbox is the
name
of the checkbox or radio button.
Property of: checkbox, and radio
The defaultChecked Property
This property returns either a True or False which indicates the default selection
status of a radio button or checkbox.
example: var=checkbox.defaultChecked
Where var is the variable you want to assign the response to and checkbox is
the
name of the checkbox or radio button.
Property of: checkbox, and radio
The length Property
This property returns a number equal to the length of the specified array or object.
The value Property
This property displays the value of the specified object
example: VALUE=document.form.object.value
Where VALUE is the variable that you want to assign the responses to, form is
the
name of the form the object is in, and object is an object from the list below.
Property of: button, checkbox, hidden, password, radio, reset,
select, submit, and text
Methods: click
click() Simulates a mouse click on a button
example: radio.nameofbutton.click()
Object Name: reset
If someone doesn't have a reset button on a form, don't you just want to beat 'em? I know I do. Reset buttons allow you to clear an entire form just by clicking one button.
The name Property
This property displays the name of the specified object.
example:
Name=object.name
The value Property
This property displays the value of the specified object
example: VALUE=document.form.object.value
Where VALUE is the variable that you want to assign the responses to, form is
the
name of the form the object is in, and object is an object from the list below.
Property of: button, checkbox, hidden, password, radio, reset,
select, submit, and text
Methods: click
click() Simulates a
mouse click on a button
example: nameofbutton.click()
Object Name: select
Ever filled out a contest online and it asked you what country you lived it? You probably had to select from a pre-defined list in a pull-down menu, right? That's a selection box, or a selection array as some call it.
example: <SELECT NAME="NAME" SIZE="SIZE"
{MULTIPLE}> <OPTION VALUE="option" {SELECTED}> Text </SELECT>
Where NAME is the name of the selection array,
SIZE sets the number of options displayed before the form scrolls, MULTIPLE, if added into
the tag, makes the array a scrolling list instead of a selection array.
The <OPTION VALUE="option"
{SELECTED}> Text specifies One menu option at a time.
To add more than one option, (which is the
purpose of a pull-down menu, you need to make a seperate <OPTION> tag for each
option. In the <OPTION> tag,
VALUE is the VALUE of the option, SELECTED, if added, makes that particular option the
pre-defined selected option, and Text is the text that you want to be displayed in the
pull-down menu.
To access the object's properties and methods,
use name.property or name.method where property or method come from the list below and
name is the name of the selection box.
Properties:
The name Property
This property displays the name of the specified object.
example:
Name=object.name
Returns the default selection status of an option in a select object.
example: defaulSelected=Boolean
Where Boolean is either True or False
The index Property
This property represents the index value of an option in a select object.
example: Name.options[i].index
Where Name is the name of the select object and i is the number of the specific
option.
The length Property
This property returns a number equal to the length of the specified array or object.
The selected Property
This property returns either a true or false that specifies the current selection state
of
an option in a select object.
example: document.form.select=index
Where index is the variable that you want to assign the response to.
The text Property
This property controls the text that follows an <OPTION> tag in a select object.
example: document.form.select.listoptions(X).text
Where form is the name of the form, X is the option number, and text is the
text
you want to display.
The value Property
This property displays the value of the specified object
example: VALUE=document.form.object.value
Where VALUE is the variable that you want to assign the responses to, form is
the
name of the form the object is in, and object is an object from the list below.
Property of: button, checkbox, hidden, password, radio, reset,
select, submit, and text
Methods:
blur()
- Removes the focus from the defined element
example: passName.blur()
focus() - Places the focus on the assigned element
example: selectName.focus(),
select() -
Selects the input area of the defined element
example: passName.select()
Object Name: string
A string is any amount of characters stored as a variable. The text is enclosed between ' ' or " ". An example of a string would be 'JavaScript' or "JavaScript".
example: string.property
or string.method
Where string is the name of the string and
property or method come from the list below.
Properties:
Methods:
anchor()
- Used to create an anchor
example:
document.write(string.anchor("contents_anchor"())
big()
- Makes text large
example: document.write(text.big())
blink()
- Makes text blink
example: document.write(text.blink())
bold()
- Makes text bold
example: document.write(text.bold())
charAt()
- Displays the character at the defined location
example: document.write(text.charAt(integer))
fixed()
- Displays text in a fixed-pitch font
example: document.write(text.fixed())
fontcolor()
- Displays text in the set color
example: document.write(text.fontcolor(color))
fontsize()
- Displays text in a set font size
example: document.write(text.fontsize(integer))
indexOf()
- Looks for the first instance of the variable A in your current string
example: document.write(text.IndexOf(A,{fromIndex}())
italics() - Displays text in italics
examples: document.write(text.italics())
lastIndexOf() - Looks for the
last instance of the variable A in the string
example: document.write(text.lastIndexOf(A,{fromIndex}())
link()
- Used to create a hypertext link
example: document.write(text.link(URL())
small()
- Makes text small
example: document.write(text.small())
strike()
- Displays text as strike-through
example: document.write(text.strike())
sub()
- Displays text in subscript
example: document.write(text.sub())
subString() -
Refers to a certain portion of a string
example: String=mystring.substring(indexA,indexB)
sup()
- Displays text in superscript
example: document.write(text.sup())
toLowerCase() - Converts a string to lower case text
example: document.write(text.toLowerCase())
toUpperCase() - Converts a
string to uppercase text
example: document.write(text.toUpperCase())
Object Name: submit
The submit object makes a submit button in an HTML form, or course, it needs to be defined within the
<FORM> and </FORM> tags.example: <INPUT TYPE="SUBMIT" NAME="NAME"
VALUE="Text">
NAME is the name of the button, and VALUE is the
text that is displayed on the face of the button.
Properties: name,
and value
The name Property
This property displays the name of the specified object.
example:
Name=object.name
Property of: button, checkbox, frame, hidden, password, radio, reset, select,
submit, text, textarea, and window
The value Property
This property displays the value of the specified object
example: VALUE=document.form.object.value
Where VALUE is the variable that you want to assign the responses
to, form is the
name of the form the object is in, and object is an object
from the list below.
Property of: button, checkbox, hidden, password, radio, reset, select, submit, and
text
Methods: click
click() Simulates a mouse
click on a button
example:
nameofbutton.click()
Object Name: text
A text object creates creates a text input field that allows the user to enter anything. Text input fields are vital to forms.
Text objects need to be defined within the <FORM> and </FORM> tags.example: <INPUT TYPE="text" NAME="name" VALUE="value" SIZE="size">
NAME is the name of the field.
VALUE is the preset text that is displayed in the
field when the page loads. If you don't want any preset text in the field, don't set it.
SIZE is an interger and represents the width (or
number of characters long) of the field.
To acces the properties and methods, use text.method or text.property. Where text is the name of the field and propertys or method comes from the list below.
Properties:
The name Property
This property displays the name of the specified object.
example: Name=object.name
Property of: button, checkbox, frame, hidden, password, radio, reset, select,
submit, text, textarea, and window
The value Property
This property displays the value of the specified object
example: VALUE=document.form.object.value
Where VALUE is the variable that you want
to assign the responses to, form is the
name of the form the object is in, and object
is an object from the list below.
Property of: button, checkbox, hidden, password, radio, reset, select, submit, and
text
The defaultValue
Property
This property sets a string as the default value for a password, text, textarea,
or
hidden field.
example: Field.defaultValue="Text"
Where Field is the name of the field, and Text is the value you want to set it to.
Property of: hidden, password, text, and textarea
Methods:
blur() - Removes the focus from
the defined element
example: passName.blur()
focus() - Places the focus on the assigned element
example: selectName.focus()
select() - Selects the input area of the defined element
example: passName.select()
Object Name: textarea
Text area objects work inside the
<FORM> and </FORM> tags and allow a user to enter multiple lines of data into a form.example: <TEXTAREA NAME="name" ROWS=rows COLS=cols
WRAP="off/virtual/physical">Text</TEXTAREA>
NAME is the name of the text area, ROWS is an
integer that specifies how many rows tall the field is. COLS is an integer that specifies
how many characters wide the field is.
WRAP is either off, virtual, or physical. Off
turns of text wrapping, virtual wraps text but sends it exactly as typed, and physical
wraps the text with new lines.
Properties:
The name Property
This property displays the name of the specified object.
example:
Name=object.name
Property of: button, checkbox, frame, hidden, password, radio, reset, select,
submit, text, textarea, and window
This property sets a string as the default value for a password, text, textarea,
or
hidden field.
example: Field.defaultValue="Text"
Where Field is the name of the field, and Text is the value you want to set it to.
Property of: hidden, password, text, and textarea
Methods:
blur() - Removes the focus from
the defined element
example: passName.blur()
focus() - Places the focus on the assigned element
example: selectName.focus()
select() - Selects the input area of the defined element
example: passName.select()
Object Name: window
The window object is the top level object for each location, history, or document object.
example: window = window.open("URL", "NAME"
{,"Features"})
window is the name of the window, URL is the
location of the page you want to open, NAME is the name of the window, and Features define
the size of the window, etc.
There are many ways to access a window's
properties and methods. They are listed below:
This property sets the default message displayed in the Status Bar
example:
window.defaultStatus="Message"
Where Message is the message you
want to display.
Property of: window
The length Property
This property returns a number equal to the length of the specified array or object.
The parent Property
This property is a synonym for a window that contains the current frame.
example: Window=frame.parent
Where Window is the variable that you want to assign the response to.
Property of: frame, and window
The pathname Property
Returns a string specifying the url-path protion of the URL.
example: Path=link.pathname
Where Path is the variable that you want to assign the response to.
Property of: frame, and window
The status Property
This property controls the text that is displayed in the status bar.
example: window.status="Message"
Where Message is the message that you want to display.
The top Property
The top property refers to the top most browser window.
example: TopWin=window.top
Where TopWin is the variable that you want to assign the response to.
Methods:
alert()
- Creates an alert dialog box
example:
window.alert("Text")
clearTimeout() - Clears the setTimeout command
example:
window.clearTimeout(TimerIDVariable)
close()
- Closes the specified window
example:
window.close()
confirm() - Creates
a confirm dialog box
example:
window.confirm("Continue? Yes or No")
open()
- Opens a new window
example:
window.open("URL","Name",["Features"])
prompt() - Creates a
prompt dialog box
example:
window.prompt("Text",[InputDefault])
setTimeout() - Runs JavaScript code for a certain number of
milliseconds
example:
window.setTimeout("String",msecs)
12/04/99