Online Documentation Server
 ÏÎÈÑÊ
ods.com.ua Web
 ÊÀÒÅÃÎÐÈÈ
Home
Programming
Net technology
Unixes
Security
RFC, HOWTO
Web technology
Data bases
Other docs

 


 ÏÎÄÏÈÑÊÀ

 Î ÊÎÏÈÐÀÉÒÀÕ
Âñÿ ïðåäîñòàâëåííàÿ íà ýòîì ñåðâåðå èíôîðìàöèÿ ñîáðàíà íàìè èç ðàçíûõ èñòî÷íèêîâ. Åñëè Âàì êàæåòñÿ, ÷òî ïóáëèêàöèÿ êàêèõ-òî äîêóìåíòîâ íàðóøàåò ÷üè-ëèáî àâòîðñêèå ïðàâà, ñîîáùèòå íàì îá ýòîì.




Previous Table of Contents Next

Appendix B
JavaScript Object Specification Syntax

Anchor Object

Creating

<A NAME="anchorName">
textOrImageAnchor
</A>

Applet Object

Creating

<APPLET
CODE="AppletURL"
HEIGHT="PixelCount"
NAME="AppletName"
WIDTH="PixelCount"
[ALIGN="AlignmentLocation"]
[ALT="AlternateTextDisplay"]
[CODEBASE="ClassFileDirectory"]
[HSPACE="MarginPixelCount"]
[VSPACE="MarginPixelCount"]>
 <PARAM NAME="AppletParameterName”  VALUE=”ParameterValue”> 
 ...
 <PARAM NAME="AppletParameterName”   VALUE=”ParameterValue”>
</APPLET>

Properties

name(string)
(Java variables)

Event Handlers

 onMouseOut=
 onMouseOver=

Methods

(Java methods)

Area Object

Creating

<MAP NAME="areaMapName">
 <AREA
   COORDS="x1,y1,x2,y2…." |"x-center,y-center,radius"
   HREF="URLorLocation"
   [NOHREF]
   [SHAPE="rect" | "poly" | "circle" | "default" ]
   [TARGET="windowName"]
   [onFocus="EventHandlerTextOrFunction"]
   [onMouseOut="EventHandlerTextOrFunction"]
   [onMouseOver="EventHandlerTextOrFunction"]>
</MAP>

Properties

links[index].target   (window name)
[location object properties]

Event Handlers

onMouseOut=
onMouseOver=

Array Object

Creating

var myArray = new Array([integer] | [val1 [ , val2 … [ , valn]]])

Properties

length(integer)
prototype (expression)

Methods

join("delimiterChar")
reverse()
sort(compareFunc)

Button, Submit, and Reset Objects

Creating

<FORM>
 <INPUT
TYPE="button" | "submit" |"reset"
[NAME="buttonName]
[VALUE="labelText"]
[onClick="EventHandlerTextOrFunction"]
[onFocus="EventHandlerTextOrFunction"]
[onLoad="EventHandlerTextOrFunction"]
[onUnLoad="EventHandlerTextOrFunction"]>
</FORM>

Properties

name  (string)
type   (string)
value  (string)

Methods

click()

Event Handlers

onClick=

Checkbox Object

Creating

<FORM>
 <INPUT
TYPE="checkbox"
[CHECKED]
[NAME="boxName]
[VALUE="buttonValue"]
[onClick="EventHandlerTextOrFunction"]>
buttonText
</FORM>

Properties

checked   (Boolean)
defaultChecked (Boolean)
name   (string)
type  (string)
value (string)

Methods

click()

Event Handlers

onClick=

Date Object

Creating

var myDate = new Date("Month dd, yyyy, hh:mm:ss")
var myDate = new Date("Month dd, yyyy")
var myDate = new Date("yy,mm,dd,hh,mm,ss")
var myDate = new Date("yy, mm, dd")
var myDate = new Date(millisecondsInteger)

Properties

prototype  (expression)

Methods

myDate.getDate()(1-31)
myDate.getDay() (0-6)
myDate.getHours()   (0-23)
myDate.getMinutes()  (0-59)
myDate.getMonth()   (0-11)
myDate.getSeconds() (0-59)
myDate.getTime()(0-…)
myDate.getTimezoneOffset()  (0-…)
myDate.getYear()(70-…)
myDate.setDate()(1-31)
myDate.setDay() (0-6)

myDate.setHours()   (0-23)
myDate.setMinutes() (0-59)
myDate.setMonth()   (0-11)
myDate.setSeconds() (0-59)
myDate.setTime()(0-…)
myDate.setYear()(70-…)
myDate.toGMTString()(String)
myDate.toLocaleString() (String)
Date.parse("dateString")
Date.UTC("date values")

Document Object

Creating

<BODY
   [ALINK="#activatedLinkColor"]
   [BACKGROUND="backgroundImageURL"]
   [BGCOLOR="#backgroundColor"]
   [LINK="#unfollowedLinkColor"]
   [TEXT="#foregroundColor"]
   [VLINK="#followedLinkColor"]
   [onLoad="#handlerTextOrFunction"]
   [onUnload="#handlerTextOrFunction"]
   </BODY>

Properties

alinkColor  (hexadecimal triplet or constant)
anchors  (array)
applets  (array)
bgColor  (hexadecimal triplet or constant)
cookie   (string)
domain   (string)
embeds   (array)
fgColor  (hexadecimal triplet or constant)
forms(array)
images   (array)
lastModified (date string)
linkColor(hexadecimal triplet or constant)
links  (array)
location (string)
referrer (string)
title(string)
URL (string)
vlinkColor   (hexadecimal triplet or constant)

Methods

write("string1" [,”string2”,...,“stringn”])
write("string1" [,”string2”,...,“stringn”])
write("string1" [,”string2”,...,“stringn”])
open("mimeType")
close()
clear()

FileUpload Object

Creating

<FORM>
<input
TYPE="file"
[NAME="fieldName"]
[SIZE="numberOfCharacters"]>
</FORM>

Properties

name (string)
value (string)
type  (string)

Methods

blur()
focus()
select()

Event Handlers

onBlur=
onChange=
onFocus=
onSelect=

Form Object

Creating

<FORM
   [ACTION="serverURL"]
   [ENCTYPE="MIMEType"]
   [METHOD=GET | POST]
   [NAME="formName"]
   [onSubmit="eventHandlerTextOrFunction"]
   [onReset="eventHandlerTextOrFunction"]
</FORM>

Properties

action   (URL)
elements (array)
encoding (MIME type)
method   (GET or POST)
name  (string)
target   (window name)

Methods

reset()
submit()

Event Handlers

onReset=
onSubmit=

Function Object

Creating

function functionName( [parameter1]...[, parameterN] ) {
   statements
 }
var myFunction = new function([parameter1]...[, parameterN], statements)

Properties

arguments  (array)
caller   (function)
prototyp (expression)

Methods

reset()
submit()

Event Handlers

onReset=
onSubmit=

Hidden Objects

Creating

<FORM>
 <INPUT
NAME="fieldName"
TYPE="hidden"
[VALUE="contents"]>
</FORM>

Properties

defaultValue(string)
name   (string)
type(string)
value   (string)

History Object

Properties

length  (integer)

Methods

back()
forward()
go(relativeNumber |"URLorTitleSubstring")

Image Object

Creating

<IMG
NAME="imageName"
SRC="imageURL"
[ALIGN="left" | "right" | "top" | "absmiddle" | "absbottom" |
 "texttop" | "middle" | "baseline" | "bottom" ]
[BORDER="pixelCount"]
[HEIGHT="pixelCount" | "percentageValue%"]
[HSPACE="pixelCount"]
[ISMAP]
[LOWSRC="lowResImageURL"]
[USEMAP="areaMapName"]
[VSPACE="pixelCount"]
[WIDTH="pixelCount" | "percentageValue%"]
[onAbort="EventHandlerTextOrFunction"]
[onError="EventHandlerTextOrFunction"]
[onLoad="EventHandlerTextOrFunction"]>

Properties

border   (integer)
complete (Boolean)
height   (integer)
hspace   (integer)
lowsrc   (string)
src  (string)
vspace   (integer)

Event Handlers

onAbort=
onError=
onLoad=

Layer Object

Properties

above
background  (colorValue)
below   (layerObject)
bgColor   (colorValue)
clip.top  (pixelCount)
clip.left (pixelCount)
clip.right  (pixelCount)
clip.bottom   (pixelCount)
clip.width  (pixelCount)
clip.height (pixelCount)
height(pixelCount)
left  (pixelCount)
layers(array)
name(string)
parentLayer   (layerObject)
siblingAbove  (layerObject)
siblingBelow  (layerObject)
top   (pixelCount)
visibility  (hide|show|inherit)
width   (pixelCount)
zIndex(integer)

Methods

offset()
moveTo()
resize()
moveAbove()
moveBelow()

Link Object

Creating

<A HREF="URLorLocation”
[NAME="anchorName”]
[TARGET="windowName”]
[onClick="EventHandlerTextOrFunction”]
[onMouseOut=”EventHandlerTextOrFunction”]
[onMouseOver=”EventHandlerTextOrFunction”]>
TextOrImageLink
</FORM>

Properties

links[index].target   (window name)
[location object properties]

Event Handlers

onClick=
onMouseOut=
onMouseOver=

Math Object

Properties

Math.E
Math.LN2
Math.LN10
Math.LOG2E
Math.LOG10E
Math.PI
Math.SQRT1_2
Math.SQRT2

Methods

Math.abs()
Math.acos()
Math.asin()
Math.atan()
Math.atan2()
Math.ceil()
Math.cos()
Math.exp()
Math.floor()
Math.log()
Math.max()
Math.min()
Math.pow()
Math.random()
Math.round()
Math.sin()
Math.sqrt()
Math.tan()

MimeType Object

Properties

description (string)
enabledPlugin   (string)
type(string)
suffixes(string)

Navigator Object

Properties

appName (string)
appVersion  (string)
appCodeName(string)
mimeTypes  (string)
plugins (string)
userAgent   (string)

Methods

javaEnabled()
taintEnabled()

Plugin Object

Properties

description (string)
enabledPlugin   (string)
type(string)
suffixes(string)

Methods

javaEnabled()
taintEnabled()

Radio Object

Creating

<FORM
 <INPUT
   NAME=”buttonGroupName”
   TYPE=”radio”
   [CHECKED]
   [VALUE=”buttonValue”]
   [onClick=”EventHandlerTextOrFunction”]
   buttonText
</FORM>

Properties

checked  (Boolean)
defaultChecked(Boolean)
name  (string)
value(string)
type (string)

Methods

click()

Event Handlers

onClick=

Select Object

Creating

<FORM
 <SELECT
   NAME=”listName”
   [MULTIPLE]
   [SIZE=”NumberOfCharacters”]
   [onBlur=”EventHandlerTextOrFunction”]
   [onChange=”EventHandlerTextOrFunction”]
   [onFocus=”EventHandlerTextOrFunction”]>
   <OPTION [SELECTED] [VALUE=”string”]>listItem
   [...<OPTION [VALUE=”string”]>listItem
 </SELECT>
</FORM> >

Properties

length  (integer)
name  (string)
options[index]  (array)
options[index].defaultSelected  (Boolean)
options[index].index(integer)
options[index].value(string)
options[index].selected(Boolean)
options[index].text(string)
selectedIndex  (integer)
type   (string)

Methods

blur()
focus()

Event Handlers

onBlur=
onChange=
onFocus=

String Object

Creating

var myString = new String(["stringExpression”])

Properties

length(integer)
prototype (expression)

Methods

myString.anchor("anchorName”)
myString.big()
myString.blink()
myString.bold()
myString.charAt(index)
myString.fixed()
myString.fontcolor(colorValue)
myString.fontsize(integer1to7)
myString.indexOf(searchString [ , startIndex])
myString.italics()
myString.lastIndexOf(searchString [ , startIndex])
myString.link(locationOrURL)
myString.small()
myString.split("delimitingChar”)
myString.strike()
myString.sub()
myString.substring(beginIndex, endIndex)
myString.sup()
myString.toLowerCase()
myString.toUpperCase()

Text, Textarea, and Password Objects

Creating

<FORM
 <INPUT
NAME=”fieldName”
TYPE=”text”
[MAXLENGTH=”MaxLengthAllowed”]
[SIZE=”NumberOfCharacters”]
[VALUE=”contents”]
[onBlur=”EventHandlerTextOrFunction”]
[onChange=”EventHandlerTextOrFunction”]
[onFocus=”EventHandlerTextOrFunction”]
[onSelect=”EventHandlerTextOrFunction”]>
</FORM>

<FORM
 <TEXTAREA
COLS=”NumberOfColumns”
NAME=”fieldName”
ROWS=”NumberOfRows”
[WRAP=”off” | "virtual” | "physical”]
[onBlur=”EventHandlerTextOrFunction”]
[onChange=”EventHandlerTextOrFunction”]
[onFocus=”EventHandlerTextOrFunction”]
[onSelect=”EventHandlerTextOrFunction”]
defaultText
 </TEXTAREA
   </FORM>

   <FORM
<INPUT
   NAME=”fieldName”
   TYPE=”password”
   [MAXLENGTH=”MaxLengthAllowed”]
   [SIZE=”CharacterLength”]
   [VALUE=”contents”]>
   </FORM>

Properties

defaultValue  (string)
name (string)
value (string)
type  (string)

Methods

blur()
focus()
select()

Event Handlers

onBlur=
onChange=
onFocus=
onSelect=

Window and Frame Objects

Creating

windowObject = window.open([parameters])

<BODY
   ...
   [onBlur=”EventHandlerTextOrFunction”]
   [onFocus=”EventHandlerTextOrFunction”]
   [onLoad=”EventHandlerTextOrFunction”]
   [onUnLoad=”EventHandlerTextOrFunction”]
   </BODY>

   <FRAMESET
   COLS=”valueList”
   ROWS=”valueList”
   [BORDER=pixelSize]
   [BORDERCOLOR=colorSpecs]
   [FRAMEBORDER=YES | NO]
   [onBlur=”EventHandlerTextOrFunction”]
   [onFocus=”EventHandlerTextOrFunction”]
   [onLoad=”EventHandlerTextOrFunction”]
   [onUnLoad=”EventHandlerTextOrFunction]
<FRAME
SRC=”locationOrURL”
NAME=”firstFrameName”
[BORDER=pixelsize]
[BORDERCOLOR=colorSpecs]
....
   </FRAMESET>

Properties

defaultStatus  (string)
frames (array)
name (string)
onerror(function)
opener (window object)
parent (window object)
self   (window object)
status (window object)
top(window object)
window (window object)

Methods

alert(message)
blur()
clearTimeout(timeoutIDnumber)
close()
confirm(message)
focus()
open("URL”,"windowName”[,,”windowSpecification”])
prompt(message,defaultReply)
scroll(horizontalPixel, verticalPixel)
setTimeout("expression”, millisecondsDelay)

Event Handlers

onBlur=
onFocus=
onLoad=
onUnload=

Control Structures

   if (condition)= {
 statements
   }

   if (condition)= {
 statements
}
else {
 statements
}

variable = (condition) ? val1 : val2

for ( [ initial expression]; [condition]; [update expression]){
 statements
}

while (condition) {
 statements
}

for (var in object) {
 statements
}

with (object) {
 statements
}

Operators

Comparison

== Equals
!= Does not equal
>  Is greater than
>= Is greater than or equal to
<  Is less than
<= Is less than or equal to

Binary & Unary

+  Plus
–  Minus
*  Multiply
/  Divide
%  Modulo
++ Increment
-- Decrement
-val   Negation

Assignment

=  Equals
+= Add the RHS (Right Hand Side)
–= Subtract the RHS
*= Multiply by the RHS
/= Divide by the RHS
%= Modulo by the RHS
<<=Left shift by the RHS
>>=Right shift by the RHS
>>>=   Right shift by the RHS, zero fill
&= Bitwise AND by the RHS
|= Bitwise OR by the RHS
^= Bitwise XOR by the RHS

Boolean

&& And
|| Or
!  Not

Bitwise

&  Bitwise And
|  Bitwise Or
^  Bitwise XOR
~  Bitwise Not
<< Left Shift
>> Right Shift
>>>  Zero Fill Right Shift

Miscellaneous

new
typeOf
void

JavaScript Functions and Methods

eval("string”)
isNan(expression)
object.toString()
parseFloat("string”)
parseInt("string”)
taint([object])
untaint([object])

Previous Table of Contents Next


With any suggestions or questions please feel free to contact us