n2i4==nn2,3,4以上,ie4以上 n3i4==nn3,4以上,ie4以上 n4i4==nn4,ie4以上 n2==nn2以上 n3==nn3以上 n4==nn4以上 i4==ie4以上 *このリファレンスは「だれでもカンタンDynamicHTMLサンプル集」と「だれでもカンタンJavaScriptサンプル集」 の巻末とCD-ROMに収録したものをベースにちょっと手をいれようかな〜と思っています。 *ここではie3は不安定なので除外しましたが、ie3はおおむねn2ベース(Mac版ie3はn4ベース)の JavaScriptで動作します(ただしマイナーバージョンや環境によってまちまちです)。 *このリファレンスはJavaScript1.2を網羅しています。ie4は本書関連項目のみピックアップしました。 *詳しくは各社のリファレンスをご覧ください。
![]()
A
above /n4__上(z)に重なっているレイヤー layer名.above abs /n2i4__絶対値 Math.abs(数値) acos /n2i4__アークコサイン Math.acos(数値) action /n2i4__ACTION属性 form名.action alert /n2i4__警告メッセージダイアログを開く alert("message") alinkColor /n2i4__カーソルで押している間のリンク色 document.alinkColor anchor /n2i4__アンカーへ跳ぶ text.anchor(anchor名) //anchor名はA NAME=""で指定したアンカー Anchor /n2i4__アンカーオブジェクト <A [HREF=locationOrURL|"Javascript:命令"] NAME"anchor名" [TARGET="window名"]> anchorText </A> anchors /n2i4__アンカー配列 1.document.anchors[index番号] //index番号は0から1,2,3.....n 2.document.anchors.length //ページ内のアンカーの数 appCodeName /n2i4__ブラウザのコードネーム navigator.appCodeName //Mozilla(IEもNN互換なのでMozillaになる) Applet /n3i4__Javaアプレット <APPLET CODE=classFile名 HEIGHT=height WIDTH=width MAYSCRIPT [NAME=applet名] [CODEBASE=classFileDirectory] [ALT=alternateText] [ALIGN="left"|"right"| "top"|"absmiddle"|"absbottom"| "texttop"|"middle"|"baseline"|"bottom"] [HSPACE=spaceInPixels] [VSPACE=spaceInPixels]> [<PARAM NAME=parameter名 VALUE=parameter Value>] [ ... <PARAM>] </APPLET> applets /n3i4__Javaアプレット配列 1. document.applets[index] 2. document.applets.length appName /n2i4__ブラウザのアプリケーション名 navigator.appName //たとえばNetscape appVersion /n2i4__ブラウザのバージョン navigator.appVersion//たとえば 3.01 (Macintosh; I; 68K)や3.0 [ja] (Win95; I)など Area /n3i4__イメージマップエリア <MAP NAME="map名"> <AREA [NAME="area名"] COORDS="x1,y1,x2,y2,..."|"x(中心),y(中心),半径" HREF="location" [SHAPE="rect"|"poly"|"circle"|"default"] [TARGET="window名"] [onMouseOut="命令"] [onMouseOver="命令"]> </MAP> "rect"は長方形で COORDS="x1,y1,x2,y2" "poly"は多角形で COORDS="x1,y1,x2,y2,x3,y3,..." "circle"は円で COORDS="x,y(中心座標),r(半径)と指定する。 "default"は画像ファイル領域すべて(他の領域指定後に指定する。先に指定すると他の指定が無効になるので注意) 1. area名.propertyName 2. document.links[index番号].propertyName arguments /n3i4__関数の(実際にひきわたされた)引数配列 1. functionName.arguments[index] 2. functionName.arguments.length arity /n4__関数の(functionで指定している)引数の数 functionName.arity Array /n3i4__配列の作成 1. arrayObject名 = new Array() 2. arrayObject名 = new Array(配列の数) 3. arrayObject名.propertyName 4. arrayObject名.methodName(パラメーター) asin /n2i4__アークサイン Math.asin(数値) atan /n2i4__アークタンジェント Math.atan(数値) atan2 /n2i4__与えた座標のアークタンジェント Math.atan2(x,y) availHeight /n4i4__スクリーンの高さ(タスクバー等除く) screen.availHeight availWidth /n4i4__スクリーンの幅(タスクバー等除く) screen.availWidth▲_TOP
B
back /n2i4__1ページ戻る history.back() frame名.back() /n4 background /n4__背景画像 layer名.background 例 oj.background.src='test.gif' /*cross-info*/i4ではoj.style.backgroundImage='url(test.gif)' backgroundColor /i4__背景色 layer名.style.backgroundColor /*cross-info*/n4ではlayer名.bgColor backgroundImage /i4__背景画像 layer名.style.backgroundImage 例 oj.style.backgroundImage='url(test.gif)' /*cross-info*/n4ではoj.background.src='test.gif' below /n4__下(z)に重なっているレイヤー layer名.below bgColor /n2i4__背景色 document.bgColor layer名.bgColor /n4__ /*cross-info*/i4ではlayer名.style.backgroundColor big /n2i4__文字を大きくする string名.big() blink /n2__文字を点滅させる string名.blink() blur /n2i4__フォーカスをはずす 1. password名.blur() 2. select名.blur() 3. text名.blur() 4. textarea名.blur() 5. windowReference.blur() /n3i4__ //ウインドウを背面へ隠す bold /n2i4__文字を太くする string名.bold() Boolean /n3__Booleanオブジェクト booleanObject名= new Boolean(value) booleanObject名.propertyName border /n3__画像の枠(ボーダー)の幅(ピクセル)を調べる image名.border break /n2i4__for、whileループから強制的に抜ける break browserLanguage /i4__ブラウザの言語コードを返す navigator.browserLanguage /*cross-info*/n4ではnavigator.language bufferDepth /i4__ディスプレイ深度 bit per pixcel screen.bufferDepth /*cross-info*/n4ではscreen.pixcelDepth button /n2i4__押しボタンオブジェクト <INPUT TYPE="button" NAME="button名" VALUE="buttonText" [onClick="命令"]> 1. button名.propertyName 2. button名.methodName(パラメーター) 3. form名.elements[index番号].propertyName 4. form名.elements[index番号].methodName(パラメーター) 5. button名.type /n3i4__ button /i4__マウスのどのボタンが押されたか event.button //1は左、2は右、3は真ん中、0はNobutton /*cross-info*/n4のevent.whichと同様だが番号割り当てが違う n4のevent.which //押キーのASCII値かマウスの押されたボタン(1左,2中,3右)▲_TOP
C
caller /n3i4__実行中のファンクションを呼び出したファンクション名を返す functionName.caller captureEvents /n4__イベントキャプチャ object名.captureEvents(eventType) ceil /n2i4__切り上げる Math.ceil(数値) charAt /n2i4__文字列から指定した位置の文字を抜き出す string名.charAt(index番号) //indexは0番目から始めて1,2,3.....nと指定 Checkbox /n2i4__チェックボックス <INPUT TYPE="checkbox" NAME="checkbox名" VALUE="checkboxValue" [CHECKED] [onClick="命令"]> textToDisplay 1. checkbox名.propertyName 2. checkbox名.methodName(パラメーター) 3. form名.elements[index番号].propertyName 4. form名.elements[index番号].methodName(パラメーター) 5. checkbox名.type (NN3.0〜) checked /n2i4__チェックボックスやラジオボタンの状態 選択されていればtrue、いなければfalse 1. checkbox名.checked 2. radio名[index番号].checked clear /n2i4__document(表示内容)の消去 document.clear() clearInterval /n4i4__setInterval()のタイマーをキャンセル clearInterval(intervalID) //intervalIDはintervalID=setInterval()でセットしたものを記入 clearTimeout /n2i4__setTimeout()のタイマーをキャンセル clearTimeout(timeoutID) //timeoutIDはtimeoutID=setTimeout()でセットしたものを記入 click /n2i4__自動クリックする 1. button名.click() 2. radio名[index番号].click() 3. checkbox名.click() clientHeight /i4__ウインドウの内高 document.body.clientHeight /*cross-info*/n4は[windowReference.]innerHeight clientWidth /i4__ウインドウの内幅 document.body.clientWidth /*cross-info*/n4は[windowReference.]innerWidth clientX /i4__マウスx座標(可視ページ内カーソル位置) event.clientX clientY /i4__マウスy座標(可視ページ内カーソル位置) event.clientY clip /n4__レイヤー内のクリップの位置 /*cross-info*/n4 1.document.layers[index番号または"layer名"].clip.left //x1_offset 2.document.layers[index番号または"layer名"].clip.top // y1_offset 3.document.layers[index番号または"layer名"].clip.right //x2_offset 4.document.layers[index番号または"layer名"].clip.bottom //y2_offset 5.document.layers[index番号または"layer名"].clip.width //クリップの幅 6.document.layers[index番号または"layer名"].clip.height //クリップの高さ /*cross-info*/i4 document.all(index番号または"layer名").style.clip 例 document.all.style.clip='rect(top,right,bottom,left)' close /n2i4__documentを閉じる サブウインドウでこれを忘れるとwriteした文字が欠けることがある document.close() close /n2i4__windowを閉じる //NN2.0では自由に閉じられたが、3.0以降はopen()で開かれたwindow以外を //closeしようとすると確認のダイアログが出る windowReference.close() closed /n3i4__windowが閉じているかどうかを返す [windowReference.]closed 例:newWin=window.open('','','') if (win1.closed){命令1}else{命令2} colorDepth /n4i4__スクリーンのカラー深度(nビットカラー) screen.colorDepth //* /n2i4__コメントをスクリプト内に記述するときに使用 1. //コメント文 2. /*複数行にわたるコメント文*/ complete /n3i4__画像読込み状況 完了ならtrue、失敗ならfalseを返す image名.complete concat /n4i4__配列を連結する 配列1.concat(配列2) confirm /n2i4__YES/NO(またはOK/キャンセル)確認ダイアログ YESならtrue、NOならfalseを返す confirm("確認のための文章") constructor /n3i4__コンストラクタ objectType.constructor continue /n2i4__for、whileループから強制的に次のループへ飛ぶ continue cookie /n2i4__cookieファイルへのアクセス document.cookie cos /n2i4__コサイン Math.cos(数値) current /n3__カレントヒストリー history.current▲_TOP
D
Date /n2i4__日付関係のオブジェクト 1. dateObject名 = new Date() 2. dateObject名 = new Date("month day, year hours:minutes:seconds") 3. dateObject名 = new Date(year, month, day) 4. dateObject名 = new Date(year, month, day, hours, minutes, seconds) 5. Date.prototype.propertyName(NN3.0〜) defaultChecked /n2i4__チェックボックスやラジオボタンのデフォルト選択状態 選択ならtrue、違えばfalse 1. checkbox名.defaultChecked 2. radio名[index番号].defaultChecked defaultSelected /n2i4__選択リストのデフォルト選択状態 選択ならtrue、違えばfalse 1.select名.options[index番号].defaultSelected 2.option名.defaultSelected (NN3.0〜) defaultStatus /n2i4__ステータスバーへのデフォルト表示 onMouseOverで使うときは最後にreturn trueを必ず付けること windowReference.defaultStatus defaultValue /n2i4__password,text,textareaのデフォルト値 1. password名.defaultValue 2. text名.defaultValue 3. textarea名.defaultValue description /n3__MIMEのタイプ名の取得 1. navigator.mimeTypes[index番号].description 2. navigator.mimeTypes[mimeType名].description 3. navigator.plugins[index番号].description 4. navigator.plugins[plugin名].description disableExternalCapture /n4__enableExternalCaptureでセットされた、 違うサーバーから読み込まれたframeやwindowへのイベントキャプチャー不可 disableExternalCapture() document /n2i4__documentオブジェクト <BODY BACKGROUND="backgroundImage" BGCOLOR="backgroundColor" TEXT="foregroundColor" LINK="unfollowedLinkColor" ALINK="activatedLinkColor" VLINK="followedLinkColor" [onLoad="命令"] [onUnload="命令"] [onBlur="命令"](NN3.0~) [onFocus="命令"]>(NN3.0~) 1. document.propertyName 2. document.methodName(パラメーター) domain /n3i4__ドメインネームを指定する document.domain▲_TOP
E
E /n2i4__オイラー定数 Math.E elements /n2i4__フォームの構成要素(各ボタンなど...) 1. form名.elements[index番号] //ページに出てくる順に0,1,2,3,..... 2. form名.elements.length //構成要素の数 3. form名.elements[index番号].value //各々の値 EMBED /n3i4__EMBEDタグについて <EMBED SRC=source NAME=embedName HEIGHT=height WIDTH=width> [parameterName=parameterValue] [ ... parameterName=parameterValue] </EMBED> 1. document.embeds[index番号] 2. document.embeds.length enabledPlugin /n3__プラグインが使えるか mimetype.enabledPlugin navigator.mimeTypes[index番号].enabledPlugin enableExternalCapture /n4__違うサーバーから読み込まれたframeやwindowへの イベントキャプチャー不可(signed script) enableExternalCapture() encoding /n2i4__フォームのエンコーディング指定 form名.encoding escape /n2i4__ISO Latin-1をASCII(%xx)形式に変換 escape("文字列") eval /n2i4__文字列を評価して数値にする eval("文字列") event /n4i4__イベント時のカーソル座標などのハンドラ情報を取得する event.propertyName /*cross-info*/ n4専用プロパティ event.type //イベントタイプ event.target //イベントを発生したHTMLオブジェクト event.layerX //x座標(レイヤー位置 xと同じ) event.layerY //y座標(レイヤー位置 yと同じ) event.pageX //x座標(ページ内カーソル位置) event.pageY //y座標(ページ内カーソル位置) event.screenX //x座標(スクリーン内カーソル位置) event.screenY //y座標(スクリーン内カーソル位置) event.which //押キーのASCII値かマウスの押されたボタン(1左,2中,3右) event.data event.modifiers //「ALT」キーを押しながらマウスボタンを押すと1を返す。 //同様に「CONTROL」キーなら2、「ALT」+「CONTROL」キーなら3、 //「SHIFT」キーなら4、「ALT」+「SHIFT」キーなら5、 //「CONTROL」+「SHIFT」キーなら6、「ALT」+「CONTROL」+「SHIFT」キーなら7を返す //--参考n4 window.pageXOffset //x座標(スクロール後の可視ページオフセット位置) window.pageYOffset //y座標(スクロール後の可視ページオフセット位置) /*cross-info*/ i4専用プロパティ event.altKey //ALTKEYの状態、押していればtrue event.button //マウスの押されたボタン(1左,2右,3中,4no)。n4のwhich参照 event.cancelBubble //イベントキャンセル event.clientX //x座標(可視ページ内カーソル位置) event.clientY //y座標(可視ページ内カーソル位置) event.ctrlKey //CTRLKEYの状態、押していればtrue event.fromElement //直前のHTMLオブジェクト(onmouseover,onmouseout) event.keyCode //押されたキーのコードを返す。n4のwhich参照 event.offsetX //x座標(レイヤー内のカーソル位置) event.offsetY //y座標(レイヤー内のカーソル位置) event.reason //データ転送状態(正常終了0,異常終了1,エラー2) event.returnValue //イベントからの戻り値 event.screenX //x座標(スクリーン内カーソル位置) event.screenY //x座標(スクリーン内カーソル位置) event.shiftKey //ShiftKEYの状態、押していればtrue event.srcElement //現在処理中のHTMLオブジェクトを返す event.srcFilter //onfilterchangeイベントを発生させたfilterオブジェクト event.toElement //直後のHTMLオブジェクト(onmouseover,onmouseout) (マウスがオブジェクトから出たか調べるのに便利) 例 if(event.toElement.id!='test'){離れた時の命令} event.type //イベントタイプ。n4と同じ event.x //x座標(親layerとの相対マウス位置) event.y //y座標(親layerとの相対マウス位置) //--参考n4 document.body.scrollLeft //x座標(スクロール後の可視ページオフセット位置) document.body.scrollTop //y座標(スクロール後の可視ページオフセット位置) exec /n4i4__ regexp.exec(文字列) regexp(文字列) exp /n2i4__べき乗 Math.exp(数値)▲_TOP
F
fgColor /n2i4__フォアグランドカラー(文字色)を指定する document.fgColor filename /n3__プラグインのファイル名を返す 1. navigator.plugins[index番号].filename 2. navigator.plugins[plugin名].filename fileUpload /n3i4__ファイルアップロード <INPUT TYPE="file" NAME="fileUpload名"> 1. fileUpload名.propertyName find /n4__ページ内の文字検索 windowReference.find(["検索文字列"][,true|false][,true|false]) //最初の論理パラメーターをtrueにすると、case-sensitive 検索 //2つ目の論理パラメーターをtrueにすると、backward 検索 fixed /n2i4__タグと同じ string名.fixed() floor /n2i4__切下げる Math.floor(数値) focus /n2i4__指定したオブジェクトにフォーカスを合わせる 1. password名.focus() 2. select名.focus() 3. text名.focus() 4. textarea名.focus() 5. windowReference.focus() /n3i4__ fontcolor /n2i4__文字の色を指定する string名.fontcolor(color) fontsize /n2i4__文字のサイズを指定する string名.fontsize(size) for /n2i4__条件式がfalseになるまで初期値を増加させながら命令を繰り返す for ( [ 初期化式 ; ] [ 条件式 ; ] [ 増加式 ] ) { 命令 } for...in /n2i4__オブジェクト内のプロパティを変数として命令を繰り返す for ( パラメーター in object ) { 命令 } form /n2i4__フォームオブジェクト <FORM NAME="form名" TARGET="window名" ACTION="serverURL" METHOD=GET | POST ENCTYPE="encodingType" [onSubmit="命令"] [onReset="命令"]> (NN3.0~ ) </FORM> 1. form名.propertyName 2. form名.methodName(パラメーター) 3. forms[index番号].propertyName 4. forms[index番号].methodName(パラメーター) forms /n2i4__フォームの配列 1. document.forms[index番号] 2. document.forms.length forward /n2i4__歴を1ページ進める history.forward() Frame /n2i4__フレームオブジェクト <FRAMESET ROWS="rowHeightList" COLS="columnWidthList" [onLoad="命令"] [onUnload="命令"] [onBlur="命令"] (NN3.0~ ) [onFocus="命令"]> (NN3.0~ ) [<FRAME SRC="locationOrURL" NAME="frame名 ">] </FRAMESET> 1. [windowReference.]frame名.propertyName 2. [windowReference.]frames[index番号].propertyName 3. window.propertyName 4. self.propertyName 5. parent.propertyName frames /n2i4__フレーム配列 1. [frameReference.]frames[index番号] 2. [frameReference.]frames.length 3. [windowReference.]frames[index番号] 4. [windowReference.]frames.length fromCharCode /n4i4__ISO-Latin-1コードを文字列に直します String.fromCharCode(num1, ..., numN) //--String.fromCharCode(getKEYCODE(e))などで押されたキーコードを文字化するのに便利 Function /n2i4__関数を作る function function名( [ パラメーター1 ] [ , パラメーター2 ] [.... , パラメーターN ] ) { 命令 }▲_TOP
G
getDate /n2i4__日付(1から31の整数) dateObject名.getDate() getDay /n2i4__曜日(0が日曜,1が月曜....整数) dateObject名.getDay() getHours /n2i4__時間(0から23の整数) dateObject名.getHours() getMinutes /n2i4__分(0から59の整数) dateObject名.getMinutes() getMonth /n2i4__月(0から11の整数) dateObject名.getMonth() getSeconds /n2i4__秒(0から59の整数) dateObject名.getSeconds() getSelection /n4__ドラッグ選択して反転した文字列を返す document.getSelection() getTime /n2i4__1970.1.1 00:00:00から経過したミリ秒(1/1000秒) dateObject名.getTime() getTimezoneOffset /n2i4__ローカル時間とグリニッジ標準時との差を分で返す dateObject名.getTimezoneOffset() getYear /n2i4__年を調べる(1990年からの西暦下2桁 整数) dateObject名.getYear() go /n2i4__ページを進めたり戻したりする history.go(数値 | "location")▲_TOP
H
handleEvent /n4__イベントの対象を特定する object名.handleEvent(event) hash /n2i4__アンカー 1. links[index番号].hash 2. location.hash 3. area名.hash /n3i4__ height /n3i4__画像の高さを返す(単位ピクセル) image名.height height /n3i4__画像の高さを返す(単位ピクセル) image名.height hidden /n2i4__フォームの陰でデータをやりとりする <INPUT TYPE="hidden" NAME="hidden名" [VALUE="textValue"]> 1. hidden名.propertyName 2. form名.elements[index番号].propertyName 3. hidden名.type (NN3.0〜) history /n2i4__ヒストリー 1. history.propertyName 2. history.methodName(パラメーター) home /n4__設定したホームページを読み込む。ホームボタンと同じ windowReference.home() host /n2i4__URLのhostname:portの取得と設定 1. links[index番号].host 2. location.host 3. area名.host /n3i4__ hostname /n2i4__URLのhostnameの取得と設定 1. links[index番号].hostname 2. location.hostname 3. area名.hostname /n3i4__ href /n2i4__URLの取得、設定 1. links[index番号].href 2. location.href 3. area名.href /n3i4__ hspace /n3i4__画像左右のマージンを返す image名.hspace▲_TOP
I
if /n2i4__もし条件がtrueなら 命令1を、違えば命令2を実行する if(条件文) { 命令1 } [ else { 命令2 } ] Image /n3i4__イメージオブジェクト <IMG [NAME="image名"] 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="Location#Map名"] [onAbort="命令"] [onError="命令"] [onLoad="命令"]> image名 = new Image([width, height]) 1. image名.propertyName 2. image名.methodName(パラメーター) 3. form名.elements[index番号].propertyName 4. form名.elements[index番号].methodName(パラメーター) image名.onabort = handlerFunction image名.onerror = handlerFunction image名.onload = handlerFunction 例 Image1 = new Image() Image1.src = "画像.gif" ... document.images[0].src = Image1.src images /n3i4__イメージ配列 1. document.images[index番号] 2. document.images.length index /n2i4__selectリスト内のオプションの位置番号(0から) 1.select名.options[indexValue].index 2.option名.index /n3i4__ index /n4i4__正規表現でマッチした文字のindex array名.index input /n4i4__正規表現でマッチした文字の元の文字 array名.input indexOf /n2i4__文字を検索する(位置を返す。なければ-1) string名.indexOf(searchValue, [fromIndex]) innerHeight /n4__ウインドウの内高 [windowReference.]innerHeight /*cross-info*/i4はdocument.body.clientHeight innerWidth /n4__ウインドウの内幅 [windowReference.]innerWidth /*cross-info*/i4はdocument.body.clientWidth isNaN /n2i4__数字ではない(Not a Number)ことを調べるtrue/false isNaN(testValue) italics /n2i4__文字をイタリックにする string名.italics()▲_TOP
J
javaEnabled /n3__Javaが使えるかどうか調べる navigator.javaEnabled() join /n3i4__個々の配列間に区切り文字を入れる array名.join(separator)▲_TOP
K
▲_TOP
L
language /n4__ブラウザの初期設定言語を返す(日本語版ならja) navigator.language /*cross-info*/i4ではnavigator.browserLanguage lastIndexOf /n2i4__字を末尾から検索する string名.lastIndexOf(searchValue, [fromIndex]) lastModified /n2i4__最終更新日を返す(動作不良) document.lastModified Layer /n4__レイヤーオブジェクト <LAYER [NAME="layer名"] [LEFT=x] //ウインドウ画面左からの位置 ピクセル数 [TOP=y] //ウインドウ画面上からの位置 ピクセル数 [Z-INDEX=z] //重なりの順番(整数) 数が多いほど手前に表示 [WIDTH=幅] //指定した幅で文字が折り返す(ピクセル数) [CLIP="x1_offset, y1_offset, x2_offset, y2_offset" | "x2_offset, y2_offset"] //x1,y1,x2,y2、または0,0,x2,y2で、囲まれた長方形区間を表示 [ABOVE="layerName"] //レイヤー"layerName"より下に表示する [BELOW="layerName"] //レイヤー"layerName"より上に表示する [VISIBILITY= SHOW | HIDE | INHERIT] //レイヤーを表示するかどうかの指定 //SHOWは表示,HIDEは隠す,INHERITは親レイヤーに従う [BGCOLOR="rgbColor"] //レイヤーの背景色 [BACKGROUND="imageURL"] //レイヤーの背景画像 > 1.layerName.propertyName 2.layerName.methodName(パラメーター) layers /n4__レイヤー配列 1.document.layers[index] 2.document.layers["layer名"] 3.document.layers.length layerX /n4__event発生時のレイヤーx座標数値または、resize時の幅。xと同じ event.layerX layerY /n4__event発生時のレイヤーy座標数値または、resize時の高さ。yと同じ event.layerY left /n4i4__ウインドウ画面左からのレイヤーの位置(ピクセル数) /*cross-info*/ n4の場合 document.layers["layer名"].left //整数 i4の場合 1.document.all("layer名").style.left //文字(12pxなど) 2.document.all("layer名").style.pixelLeft //整数 3.document.all("layer名").style.posLeft //浮動小数点 length /n2i4__個数(長さ)を返す 1. form名.length 2. frameReference.length 3. history.length 4. radio名.length 5. select名.length 6. string名.length 7. windowReference.length 8. anchors.length 9. elements.length 10. forms.length 11. frameReference.frames.length 12. windowReference.frames.length 13. links.length 14. select名.options.length 15. array名.length /n3i4__ 16. images.length /n3i4__ 17. navigator.plugins[index番号].length /n3i4__ 18. navigator.plugins[plugin名].length /n3i4__ 19. document.layers.length /n3i4__ link /n2i4__リンクオブジェクト <A HREF=locationOrURL|"javascript:命令" [NAME="anchor名"] [TARGET="window名"] [onClick="命令"] [onMouseOver="命令"]> linkText </A> link /n2i4__リンク先を指定する linkText.link(hrefAttribute) links /n2i4__リンク配列 1. document.links[index番号] 2. document.links.length 3. document.links[index番号].propertyName linkColor /n2i4__クリックを押す前のリンク文字の色 document.linkColor LN10 /n2i4__10の自然対数 Math.LN10 LN2 /n2i4__2の自然対数 Math.LN2 load /n4__ load(sourcestring,width) location /n2i4__URLの取得と設定(指定のページへ跳ぶ) 1. [windowReference.]location[.propertyName] 2. [windowReference.]location.methodName(パラメーター) /n3i4__ location /n2i4__URLについての情報の読みだし document.location locationbar /n4__ロケーションバー [windowReference.]locationbar.visible= [true, false] | [1, 0] log /n2i4__自然対数 Math.log(数値) LOG10E /n2i4__log10e Math.LOG10E LOG2E /n2i4__log2e Math.LOG2E lowsrc /n3i4__低解像度画像アドレスの取得と書き込み image名.lowsrc▲_TOP
M
Math /n2i4__Mathオブジェクト 1. Math.propertyName 2. Math.methodName(パラメーター) max /n2i4__最大値 (数値1と数値2のうち大きいほうを返す) Math.max(数値1, 数値2) MAX_VALUE /n3i4__JavaScriptで扱える最大値 1.79E+308を返す。これより大きい値はinfinity(無限大)となる Number.MAX_VALUE menubar /n4__メニューバー [windowReference.]menubar.visible = [true, false] | [1, 0] method /n2i4__フォームの送信方法(postかgetか)の指定 form名.method mimeTypes /n3__使えるMIMEタイプを調べる navigator.mimeTypes[index番号].propertyName min /n2i4__最小値 (数値1と数値2のうち小さいほうを返す) Math.min(数値1, 数値2) MIN_VALUE /n3i4__JavaScriptで扱える最小値 2.22E-308を返す。これより小さい値は0となる Number.MIN_VALUE modifiers /n4__特殊キーを返す event.modifiers //「ALT」キーを押しながらマウスボタンを押すと1を返す。 // 同様に「CONTROL」キーなら2、 //「ALT」+「CONTROL」キーなら3、 //「SHIFT」キーなら4、 //「ALT」+「SHIFT」キーなら5、 //「CONTROL」+「SHIFT」キーなら6、 //「ALT」+「CONTROL」+「SHIFT」キーなら7を返す moveAbove /n4__レイヤーを前に出す moveAbove(layer) moveBelow /n4__レイヤーを後ろに入れる moveBelow(layer) moveBy /n4__ブラウザ自身を起点として動かす windowReference.moveBy(水平方向ピクセル数, 垂直方向ピクセル数) moveTo /n4__ブラウザやレイヤーをxy座標で動かす 1.windowReference.moveTo(x座標, y座標) //ディスプレイ左上が0,0 2.Layer名.moveTo(x座標, y座標) //ブラウザの画面左上が0,0 3.document.layers[index番号または"layer名"].offset(x, y) moveToAbsolute /n4__上位レイヤーに対する絶対位置へ移動する oj.moveToAbsolute(x,y)▲_TOP
N
name /n2i4__オブジェクトの名前 1. object名.name 2. frameReference.name 3. frameReference.frames.name 4. radio名[index番号].name 5. select名.options.name 6. windowReference.name 7. windowReference.frames.name 8. fileUpload名.name /n3i4__ 9. image名.name /n3i4__ 10.navigator.plugins[index番号].name /n3i4__ 11.navigator.plugins[plugin名].name /n3i4__ 12.document.layers[index番号または"layer名"].name /n4__ navigator /n2i4__使用しているブラウザの情報を取得する navigator.propertyName NEGATIVE_INFINITY /n3i4__負の無限大 Number.NEGATIVE_INFINITY new /n2i4__オブジェクトのインスタンスを作る(実際に使える状態する)演算子 object名 = new objectType ( パラメーター1 [ , パラメーター2 ] ...[ , パラメーターN ] ) Number /n3i4__数値オブジェクトの生成 numberObjectName = new Number() numberObjectName.propertyName Number() /n4i4__文字列を数値にする(NN4.0〜) 例 var x = "3";Number(x) = 3 //n2で(x - 0)を処理させるのと同じ▲_TOP
O
offset /n4__現在の位置から右にx、下にyピクセル位置をずらす 1.document.layers[index番号または"layer名"].offset(x, y) onAbort /n3i4__画像読み込み中止時(stopを押した時など)命令を実行する <IMG NAME=" " SRC="画像.gif" onAbort="命令"> onBlur /n2i4__フォームやフレームがフォーカスを失うと命令を実行する 1. <SELECT NAME="" onBlur="命令"> 2. <INPUT TYPE="text" onBlur="命令"> 3. <INPUT TYPE="textarea" onBlur="命令"> 4. <BODY onBlur="命令"> /n3i4__ onChange /n2i4__フォームの入力内容が変更されたら命令を実行する 1. <SELECT NAME="" onChange="命令"> 2. <INPUT TYPE="text" onChange="命令"> 3. <INPUT TYPE="textarea" onChange="命令"> onClick /n2i4__クリックされたら命令を実行する 1. <INPUT TYPE="button" onClick="命令"> 2. <INPUT TYPE="checkbox" onClick="命令"> 3. <INPUT TYPE="radio" onClick="命令"> 4. <INPUT TYPE="reset" onClick="命令"> 5. <INPUT TYPE="submit" onClick="命令"> 6. <A HREF=locationOrURL onClick="命令"> 7. oj.onclick=実行するfunction /n4i4__ ondragdrop /n4__ブラウザへファイル等のドラック&ドロップをすると命令を実行。可(true)/不可(false) oj.ondragdrop=実行するfunction onerror /n3i4__画像やページのロードエラー時に命令を実行する 1. <IMG NAME=" " SRC="画像.gif" onError="null"> 2. window.onerror=null //エラーダイアログを出さないようにする 3. window.onerror=実行するfunction onFocus /n2i4__フォームやフレームにフォーカスすると命令を実行しする 1. <SELECT NAME="" onChange="命令"> 2. <INPUT TYPE="text" onChange="命令"> 3. <INPUT TYPE="textarea" onChange="命令"> 4. <BODY onFocus="命令"> /n3i4__ 5. oj.onfocus=実行するfunction /n4i4__ onKeyDown /n4i4__キーを押したら命令を実行する onKeyDown eventがfalseなら後ろにあるonKeyPressは実行しない oj.onkeydown=実行するfunction onKeyPress /n4i4__キーを押している間命令を繰り返し実行する 前にあるonKeyDownがfalseなら実行しない oj.onkeypress=実行するfunction onKeyUp /n4i4__キーを離したら実行する oj.onKeyup=実行するfunction onLoad /n2i4__ページや画像を読み込み終了したら命令を実行する 1. <BODY onLoad="命令"> 2. image名.onload=命令 /n3i4__ 3. <IMG NAME=" " SRC="画像.gif" onLoad="命令"> /n3i4__ 4. oj.onload=実行するfunction /n4i4__ onMouseDown /n4i4__マウスボタンを押したら実行する oj.onmousedown=実行するfunction onMouseMove /n4i4__カーソルを動かしたら実行する oj.onmousemove=実行するfunction Event Capturing時のみ onMouseOut /n3i4__リンクやイメージマップエリアからマウスカーソルが出たときに命令を実行する 1. <A HREF=locationOrURL onMouseOut="命令"> 2. <AREA COORDS=" " HREF="location" onMouseOut="命令" 3. oj.onmouseout=実行するfunction /n4i4__ //onMouseOutの中でstatusかdefaultStatusを使うときはreturn trueが必要 例 onMouseOut="status='文章';return true" onMouseOver /n2i4__リンクやイメージマップエリアにマウスカーソルが入ったときに命令を実行する 1. <A HREF=locationOrURL onMouseOver="命令"> 2. <AREA COORDS=" " HREF="location" onMouseOver="命令"> /n3i4__ 3. oj.onmouseover=実行するfunction /n4i4__ //onMouseOverのなかでstatusかdefaultStatusを使うときはreturn trueが必要 例 onMouseOver="status='文章';return true" onMouseUp /n4i4__マウスボタンを離したら実行する oj.onmouseup=実行するfunction onMove /n4__ウインドウかフレームを動かしたら実行する oj.onmove=実行するfunction onReset /n2i4__フォームをリセットしたときに命令を実行する 1. <FORM onReset="命令"> onResize /n4i4__ウインドウかフレームをリサイズしたら実行する 1. oj.onresize=実行するfunction onSelect /n2i4__textかtextareaが選択されたときに命令を実行する 1. <INPUT TYPE="text" onSelect="命令"> 2. <INPUT TYPE="textarea" onSelect="命令"> onSubmit /n2i4__フォーム送信時に命令を実行する 1. <FORM onSubmit="命令"> onUnload /n2i4__ページを抜けるときに命令を実行する 1. <BODY onUnload="命令"> 2. oj.onunload=実行するfunction /n4i4__ opener /n3i4__新しいウインドウを開いた元のウインドウを指定する(NN3.0〜) window.opener open /n2i4__documentをオープンする document.open(["mimeType"]) "mimeType"は通常は"text/html"だが省略可 open /n2i4__windowをオープンする [windowVar = ][window].open("URL", "window名", ["windowFeatures"]) ※windowFeaturesには次の指定が可能 toolbar [=yes|no]|[=1|0] //ツールバー有無 loction [=yes|no]|[=1|0] //ロケーションフィールド有無 directories [=yes|no]|[=1|0] //ディレクトリボタン有無 status [=yes|no]|[=1|0] //ステータスバー有無 menubar [=yes|no]|[=1|0] //メニューバー有無 scrollbars [=yes|no]|[=1|0] //スクロールバー有無 resizable [=yes|no]|[=1|0] //リサイズ可不可 width=pixels //ウインドウサイズ幅 Min100pxまで height=pixels //ウインドウサイズ高さ Min100pxまで left=pixels //ディスプレイleftからのピクセル数 /n4__ top=pixels //ディスプレイtopからのピクセル数 /n4__ /*cross-info*/ n4専用Features(i4のFeaturesと重複指定可能です) titlebar [=yes|no]|[=1|0] //タイトルバー有無 /n4__ //innerWidthからouterHeightまでは100*100ピクセル以下でも可能 innerWidth=pixels //ウインドウの内幅 /n4__ innerHeight=pixels //ウインドウの内高 /n4__ outerWidth=pixels //ウインドウの外幅 /n4__ outerHeight=pixels //ウインドウの外高 /n4__ screenX=pixels //スクリーン上のx座標 /n4__ screenY=pixels //スクリーン上のy座標 /n4__ alwaysLowered [=yes|no]|[=1|0] /n4__ alwaysRaised [=yes|no]|[=1|0] //キャンバスモード(常に手前に表示) /n4__ dependent [=yes|no]|[=1|0] /n4__ hotkeys [=yes|no]|[=1|0] /n4__ z-lock [=yes|no]|[=1|0] /n4__ //z方向(重なり)の順序を固定する /n4__ /*cross-info*/ i4専用Features(n4のFeaturesと重複指定可能です) fullscreen [=yes|no]|[=1|0] //フルスクリーン 注:Webではかなり迷惑かも^^;WinならALT+F4でclose channelmode [=yes|no]|[=1|0] //channelモード options /n2i4__セレクトオプション配列 select名.options[index番号].propertyName Option /n3i4__オプションコンストラクタ 新しいオプションオブジェクトを使える状態にする option名 = new Option([optionText, optionValue, defaultSelected, selected]) select名.options[index番号]=option名 //オプション内容を書き換る outerHeight /n4__ウインドウの外高 [windowReference.]outerHeight outerWidth /n4__ウインドウの外幅 [windowReference.]outerWidth▲_TOP
P
pageX /n4__カーソルx座標ページ内の位置(ピクセル) event.pageX /*cross-info*/i4のdocument.body.scrollLeft+event.clientXに相当 pageXOffset /n4__x座標(スクロール後の可視ページオフセット位置) window.pageXOffset /*cross-info*/i4のdocument.body.scrollLeftに相当 pageY /n4__カーソルy座標ページ内の位置(ピクセル) event.pageY /*cross-info*/i4のdocument.body.scrollTop+event.clientYに相当 pageYOffset /n4__y座標(スクロール後の可視ページオフセット位置) window.pageYOffset /*cross-info*/i4のdocument.body.scrollTopに相当 parent /n2i4__親ウインドウ親フレームを参照する 1. parent.propertyName 2. parent.methodName 3. parent.frame名 4. parent.frames[index番号] parentLayer /n4__親レイヤー 1.document.layers[index番号または"layer名"].parentLayer.propertyName //なければnullを返す parse /n2i4__文字列を1970.1.1 00:00:00から経過したミリ秒(1/1000秒)に変換 Date.parse("date文字列") parseFloat /n2i4__文字を浮動小数点に変換する parseFloat("文字列") parseInt /n2i4__文字を整数に変換する parseInt("文字列" [,radix]) //radixは16進数なら16,10進数なら10など //指定無しか0なら "0x"で始まると16,"0"で始まると8,その他は10と解釈 personalbar /n4__ディレクトリボタン [windowReference.]personalbar.visible= [true, false] | [1, 0] password /n2i4__パスワードオブジェクト <INPUT TYPE="password" NAME="password名" [VALUE="textValue"] SIZE=integer> 1. password名.propertyName 2. password名.methodName(パラメーター) 3. form名.elements[index番号].propertyName 4. form名.elements[index番号].methodName(パラメーター) 5. password名.type /n3i4__ pathname /n2i4__URLのパス部分 1. links[index番号].pathname 2. location.pathname 3. area名.pathname /n3i4__ PI /n2i4__円周率 3.14159.... Math.PI platform /n4__プラットフォーム名 (Win32, Win16, Mac68k, MacPPC Unix)などを返す navigator.platform plugins /n4__インストールしているプラグインを返す navigator.plugins[index番号].propertyName pixelLeft /i4__ウインドウ画面左からのレイヤーの位置(整数) posLeft /i4__ウインドウ画面左からのレイヤーの位置(浮動小数点) /*cross-info*/ n4の場合 document.layers["layer名"].left //整数(ピクセル) i4の場合 1.document.all("layer名").style.left //文字(12pxなど) 2.document.all("layer名").style.pixelLeft //整数 3.document.all("layer名").style.posLeft //浮動小数点 port /n2i4__通信ポート 1. links[index番号].port 2. location.port 3. area名.port /n3i4__ POSITIVE_INFINITY /n3i4__正の無限大 Number.POSITIVE_INFINITY pop /n4__配列の後尾を削除する array名.pop() pow /n2i4__べき乗 Math.pow(base, exponent) //baseのexponent乗です preferences /n4__Navigator preferencesを取得/設定する(signed script) preference(preferences名) preference(preferences名, set値) previous /n3__ヒストリー内の前のURL history.previous print /n4__印刷。printボタンと同じ 1. windowReference.print() 2. frameReference.print() prompt /n2i4__入力用ダイアログを出す prompt("メッセージ", ["デフォルトで表示される入力文字列"]) protocol /n2i4__プロトコル(URLの先頭部分"http:"など)を指定する 1. links[index番号].protocol 2. location.protocol 3. area名.protocol (NN3.0〜) prototype /n4__オブジェクトにプロパティを追加する objectType.prototype.propertyName=値 push /n4__配列の後尾に追加する array名.push(elt1, ..., eltN)▲_TOP
Q
▲_TOP
R
Radio /n2i4__ラジオボタンオブジェクト <INPUT TYPE="radio" NAME="radio名" VALUE="buttonValue" [CHECKED] [onClick="命令"]> textToDisplay 1. radio名[index番号].propertyName 2. radio名[index番号].methodName(パラメーター) 3. form名.elements[index番号].propertyName 4. form名.elements[index番号].methodName(パラメーター) 5. radio名.type (NN3.0〜) random /n3i4__0から1までのランダム(乱数)を作る Math.random() referrer /n2i4__リンク元ページのURLを返す document.referrer refresh /n2__プラグインをリフレッシュする navigator.plugins.refresh([true|false]) releaseEvents /n4__イベントキャプチャーを解除する objectReference.releaseEvents(eventType) reload /n3i4__リロード location.reload([true]) //trueで強制リロード replace /n3__指定したURLをヒストリーに置き換え登録する window.location.replace("URL") reset /n2i4__リセットボタンオブジェクト <INPUT TYPE="reset" NAME="reset名" VALUE="buttonText" [onClick="命令"]> 1. reset名.propertyName 2. reset名.methodName(パラメーター) 3. form名.elements[index番号].propertyName 4. form名.elements[index番号].methodName(パラメーター) 5. form名.reset() (NN3.0〜) 6. reset名.type (NN3.0〜) return /n2i4__値や式を返す return 値または式 reverse /n3i4__配列の順序を反転させる array名.reverse() resize /n4__レイヤーのサイズ変更 1.Layer名.resize(幅ピクセル, 高さピクセル) 2.document.layers[index番号または"layer名"].resize(幅ピクセル, 高さピクセル) resizeBy /n4__ウインドウサイズを変える(現寸をべ−スとして) windowReference.resizeBy(水平方向ピクセル, 垂直方向ピクセル) resizeTo /n4__ウインドウサイズを変える windowReference.resizeTo(幅ピクセル, 高さピクセル) round /n4__四捨五入 Math.round(数値) routeEvent /n4__ objectReference.routeEvent(event)▲_TOP
S
screen /n4i4__スクリーンについての情報を返す screen.property名 screen.width //ディスプレイ画面の幅(ピクセル) screen.height //ディスプレイ画面の高さ(ピクセル) screen.colorDepth //ディスプレイ画面の表示可能色数 /*cros-info*/ n4専用 screen.pixelDepth //ディスプレイ画面の表示ピクセル screen.availHeight //スクリーンの高さ(タスクバー等除く) screen.availWidth //スクリーンの幅(タスクバー等除く) /*cros-info*/ i4専用 screen.bufferDepth //オフスクリーンバスケット有無 screen.updateInterval //画面の更新間隔(ミリ秒) screenX /n4i4__カーソルx座標数値。スクリーン内の位置(ピクセル) event.screenX screenY /n4i4__カーソルy座標数値。スクリーン内の位置(ピクセル) event.screenY scroll /n3i4__ドキュメント全体を指定の座標にスクロールする windowReference.scroll(x座標,y座標) scrollbar /n4__スクロールバー [windowReference.]scrollbar.visible= [true, false] | [1, 0] scrollBy /n4i4__ぺ−ジスクロール(現位置べ−ス) //IEは現在表示されているdocumentのサイズを超えてスクロール可能、NNは不可 windowReference.scrollBy(水平方向ピクセル数, 垂直方向ピクセル数) scrollTo /n4i4__ぺ−ジスクロール //IEは現在表示されているdocumentのサイズを超えてスクロール可能、NNは不可 windowReference.scrollTo(x座標, y座標) search /n2i4__URLのなかのサーチ情報(?ではじまる)文字列 1. links[index番号].search 2. location.search 3. area名.search /n3i4__ select /n2i4__セレクトオブジェクト <SELECT NAME="select名" [SIZE="integer"] [MULTIPLE] [onBlur="命令"] [onChange="命令"] [onFocus="命令"]> <OPTION VALUE="optionValue" [SELECTED]> textToDisplay [ ... <OPTION> textToDisplay] </SELECT> 1. select名.propertyName 2. select名.methodName(パラメーター) 3. form名.elements[index番号].propertyName 4. form名.elements[index番号].methodName(パラメーター) 5. select名.options[index番号].propertyName 6. form名.elements[index番号].options[index番号].propertyName 1. select名.options 2. select名.options[index番号] 3. select名.options.length 4. select名.length 5. select名.options.length ※セレクトオプションコンストラクタ /n3i4__ //新しいセレクトオプションを作り使える状態にする option名 = new Option([optionText, optionValue, defaultSelected, selected]) select名.options[index番号]=option名 select /n2i4__入力フォームを選択(ハイライト)状態にする 1. password名.select() 2. text名.select() 3. textarea名.select() selected /n2i4__セレクトオプションの選択を操作する 1. select名.options[index番号].selected 2. option名.selected (NN3.0〜) //選択されるとtrueを返す selectedIndex /n2i4__セレクトオプションのなかで選ばれた番号(0からはじまる)を返す 1. select名.selectedIndex 2. select名.options.selectedIndex self /n2i4__カレント(現在の)ウインドウやフレームを返す 1. self.propertyName 2. self.methodName setAttribute /n5i5__タグの属性と値を設定する Object名.setAttribute('Attribute名',値) setDate /n2i4__日を設定する(1から31の整数) dateObject名.setDate(dayValue) setHours /n2i4__時を設定する(0から23の整数) dateObject名.setHours(hoursValue) setMinutes /n2i4__分を設定する(0から59の整数) dateObject名.setMinutes(minutesValue) setMonth /n2i4__月を設定する(0から11の整数) dateObject名.setMonth(monthValue) setSeconds /n2i4__秒を設定する(0から59の整数) dateObject名.setSeconds(secondsValue) setTime /n2i4__1970.1.1 00:00:00から経過したミリ秒(1/1000秒)を設定する dateObject名.setTime(timevalue) setTimeout /n2i4__ミリ秒後に命令を実行する timeoutID=setTimeout("命令", ミリ秒[,arg1,...,argn]) //clearTimeout(timeoutID)でキャンセル setInterval /n2i4__ミリ秒後毎に繰り返し命令を実行する intervalID=setInterval("命令", ミリ秒[,arg1,...,argn]) //clearInterval(intervalID)でキャンセル setYear /n2i4__年を設定する(1990年からの西暦下2桁 整数) dateObject名.setYear(yearValue) shift /n4__配列の最初の1件を削除する。indexが変わります。 array名.shift() sin /n2i4__サイン Math.sin(数値) siblingAbove /n4__1つ上のレイヤーを参照する 1.document.layers[index番号または"layer名"].siblingAbove.propertyName //なければnullを返す siblingBelow /n4__1つ下のレイヤーを参照する 1.document.layers[index番号または"layer名"].siblingBelow.propertyName //なければnullを返す slice /n4__指定位置間の配列を抜き出します array名.slice(開始index番号,終了index番号) splice /n4__指定位置の配列内の要素を削って新しい要素を追加する array名.splice(削除開始index番号, 削除数, newElt1, ..., newEltN) small /n2i4__文字サイズを1ランク小さくする string名.small() sort /n3i4__配列をソートする array名.sort(compareFunction) //compareFunctionはソートの順序を指定する比較関数 //比較関数のreturn値によってソートされる。指定無しなら辞書順 (ASCIIの昇順) 例 function compare(a,b){return a-b} split /n3i4__文字列を指定のセパレーターで切り離して配列にする string名.split([separator]) sqrt /n2i4__平方根 Math.sqrt(数値) SQRT1_2 /n2i4__1/2の平方根(約0.7071) Math.SQRT1_2 SQRT2 /n2i4__2の平方根(約1.4142) Math.SQRT2 src /n3i4__画像のURLを指定する これを使って、現在表示されている画像に別の画像を読み込むことができる image名.src status /n2i4__ステータス行に文字を表示する windowReference.status statusbar /n4__ステータスバー [windowReference.]statusbar.visible= [true, false] | [1, 0] stop /n4__読み込みを中止する ストップボタンと同じ windowReference.stop() strike /n2i4__文字の上に取消線をひく string名.strike() string /n2i4__文字列を操作するオブジェクト 1. string名.propertyName 2. string名.methodName(パラメーター) stringObject名 = new String("文字列") /n3i4__ String() /n4i4__数値を文字列にする 例 var x = 3;String(x) = "3" //"" + xと同じ sub /n2i4__文字を下付にする(SUBタグと同じ) string名.sub() submit /n2i4__フォーム内容をサーバーへ送信する form名.submit() submit /n2i4__サブミットオブジェクト <INPUT TYPE="submit" NAME="submit名" VALUE="buttonText" [onClick="命令"]> 1. submit名.propertyName 2. submit名.methodName(パラメーター) 3. form名.elements[index番号].propertyName 4. form名.elements[index番号].methodName(パラメーター) substr /n2i4__指定位置から指定数の文字を返す '参照文字'.substr(参照開始位置,指定数) string名.substr(参照開始位置,指定数) substring /n2i4__参照位置間の文字を返す '参照文字'.substring(参照開始位置,参照終了位置) string名.substring(参照開始位置,参照終了位置) suffixes /n3__プラグインやヘルパーアプリで使用できる ファイルの拡張子を調べる 1.navigator.mimeTypes[index番号].suffixes 2.navigator.mimeTypes["mimeType"].suffixes //指定されていないmimeTypesはエラーになる sup /n2i4__文字を上付にする(SUPタグと同じ) string名.sup() swich /n4i4__expressionに代入されたラベル名で分岐する 例 switch (getKEYCODE(e)){ case 48 : alert(0+'です') ; break ; case 50 : alert(1+'です') ; break ; default : alert('その他') ; }▲_TOP
T
tan /n2i4__タンジェント Math.tan(数値) taint /n3__他のサーバーから読み込まれたwindowのプロパティを一時的に読めるようにする taint(dataElementName) taintEnabled /n3__taintingが可能かどうかをtrue/falesで返す navigator.taintEnabled() target /n2i4__新しいページを読み込むウインドウを指定する 1. form名.target 2. links[index番号].target 3. area名.target /n3i4__ Text /n2i4__テキストオブジェクト <INPUT TYPE="text" NAME="text名" VALUE="textValue" SIZE=integer [onBlur="命令"] [onChange="命令"] [onFocus="命令"] [onSelect="命令"]> 1. text名.propertyName 2. text名.methodName(パラメーター) 3. form名.elements[index番号].propertyName 4. form名.elements[index番号].methodName(パラメーター) 5. text名.type /n3i4__ 6. select名.options[index番号].text /n3i4__ text /n2i4__セレクトオプションのTEXTを取得/設定する 1. select名.options[index番号].text /n3i4__ 2. option名.text /n3i4__ Textarea /n2i4__テキストエリアオブジェクト <TEXTAREA NAME="textarea名" ROWS="integer" COLS="integer" WRAP="off|virtual|physical" [onBlur="命令"] [onChange="命令"] [onFocus="命令"] [onSelect="命令"]> textToDisplay </TEXTAREA> 1. textarea名.propertyName 2. textarea名.methodName(パラメーター) 3. form名.elements[index番号].propertyName 4. form名.elements[index番号].methodName(パラメーター) 5. textarea名.type (NN3.0〜) this /n2i4__現在のオブジェクトを参照する this [ . propertyName ] title /n2i4__TITLEタグで定義されたタイトル文字を読み出す document.title toGMTString /n2i4__日付形式をGMT形式にする dateObject名.toGMTString() toLocaleString /n2i4__日付形式をローカル時間形式に変換する dateObject名.toLocaleString() toLowerCase /n2i4__小文字にする string名.toLowerCase() //反対はtoUpperCase toolbar /n4__ツールバー [windowReference.]toolbar.visible= [true, false] | [1, 0] top /n2i4__最上位のウインドウを指す 1. top.propertyName 2. top.methodName 3. top.frame名 4. top.frames[index番号] top /n4i4__ウインドウ画面上からのレイヤーの位置(ピクセル) /*cross-info*/ n4の場合 document.layers["layer名"].top //整数 i4の場合 1.document.all("layer名").style.top //文字(12pxなど) 2.document.all("layer名").style.pixelTop //整数 3.document.all("layer名").style.posTop //浮動小数点 toString /n3i4__オブジェクトを文字に変換する object名.toString(radix) toUpperCase /n2i4__大文字にする string名.toUpperCase() //反対はtoLowerCase type /n3i4__各要素のタイプ("button"や"text"など)を返す 1. object名.type 2. mimeTypes[index番号].type typeof /n3i4__オペランドのタイプを返す typeof データ▲_TOP
U
unescape /n2i4__ASCIIコードを文字列に変換する関数 unescape("文字列") unshift /n4__配列の頭に追加する。indexが変わります。 array名.unshift(elt1,..., eltN) untaint /n3__taintの許可を取り消す untaint(dataElementName) unwatch /n4__watchpoint setを解除します oj名.unwatch(prop) userAgent /n2i4__ユーザーエージェント ブラウザとマシンの情報を取り出す navigator.userAgent //たとえば Mozilla/3.01 (Macintosh; I; 68K)など URL /n2i4__カレント(現在の)URLを返す document.URL UTC /n2i4__1990.1.1 00:00:00からのミリ秒(1/1000秒)をGMTで返す Date.UTC(year, month, day [, hrs] [, min] [, sec])▲_TOP
V
value /n2i4__VALUE属性を操作 1. object名.value 2. radio名[index番号].value 3. select名.options.[index番号].value 4. fileUpload名.value /n3i4__ 5. option名.value /n3i4__ valueOf /n4__オブジェクトの値 objectName.valueOf() var /n2i4__変数を宣言するキーワード 省略も可能ですが、関数のなかだけに限定して使うローカルとして宣言するときには明示的にvarを付ける必要がある var var名 [ = value ] [ .... , var名 [ = value ] ] visibility /n4i4__レイヤーを表示するかどうかの指定 visible(n4はshowも可)は表示, hidden(n4はhideも可)は隠す, inheritは親レイヤーに従う /*cros-info*/ n4の場合 document.layers["layer名"].visibility = ["show"|"visible"] | ["hide"|"hidden"] | "inherit" i4の場合 document.all("layer名").style.visibility = "visible" | "hidden" | "inherit" vlinkColor /n2i4__すでに行ったリンク色 document.vlinkColor void /n3i4__ハイパーテキストリンクに式を記述する演算子 <A HREF="javascript:void(expr)">リンク文字など</A> //void(0)でなにも実行しない vspace /n3i4__画像と上下のテキスト間のマージン(単位ピクセル) image名.vspace▲_TOP
W
watch /n4__ oj名.watch(prop, handler) which /n4__押されたキーのASCII値かマウス1は左、2は中、3は右ボタンを返す event.which /*cross-info*/i4のevent.buttonと同様だが番号割り当てが違う i4のevent.button //1は左、2は右、3は真ん中、0はNobutton while /n2i4__条件文がtrueの間命令文をくりかえす while(条件文){命令文} width /n3i4__画像の幅を返す(単位ピクセル) image名.width window /n2i4__ウインドウオブジェクト windowVar = window.open("URL", "window名" [,"windowFeatures"]) 1. window.propertyName 2. window.methodName(パラメーター) 3. self.propertyName 4. self.methodName(パラメーター) 5. top.propertyName 6. top.methodName(パラメーター) 7. parent.propertyName 8. parent.methodName(パラメーター) 9. windowVar.propertyName 10. windowVar.methodName(パラメーター) 11. propertyName 12. methodName(パラメーター) with /n2i4__objectを省略表記できるようにする with(object){objectを省略した命令文} write /n2i4__documentに書く document.write(expression1 [,expression2], ...[,expressionN]) writeln /n2i4__documentに書く(最後に改行コード付) document.writeln(expression1 [,expression2], ...[,expressionN])▲_TOP
X
x /n4__event発生時のレイヤーx座標数値。LayerXと同じ。現在は公表されていない。 event.x▲_TOP
Y
y /n4__event発生時のレイヤーy座標数値。LayerYと同じ。現在は公表されていない。 event.y▲_TOP
Z
zIndex /n4i4__レイヤーの重なり順を表わすindex番号。0から始まり大きいほど手前になる。 /*cros-info*/ n4の場合 document.layers["layer名"].zIndex [ = 数値 ] i4の場合 document.all("layer名").style.zIndex [ = 数値 ]