Ajax Prototype Window Class アラートダイアログを表示する

-


Topページ  >  お勉強  >  Ajax  >  アラートダイアログを表示する 

アラートダイアログを表示する

Dialog.alertメソッドを使用して、アラートダイアログを表示します。

※ 別途 prototype.js が必要です。




Prototype Window Class


使用バージョン:1.2.1 公式サイト





1. ダウンロードしたprototype.jsを読み込みます。

<script type="text/javascript"
     src="./prototype.js"></script>


2. ダウンロードしたeffects.jsを読み込みます。

<script type="text/javascript"
     src="./effects.js"></script>


3. ダウンロードしたwindow.jsを読み込みます。

<script type="text/javascript"
     src="./window.js"></script>


4. ダウンロードしたdefault.cssを読み込みます。

// このCSSファイルで、アラートダイアログ表示時の基本部分がレイアウトされます。
<link rel="stylesheet"<br />
     href="./default.css" type="text/css" media="all">


5. ダウンロードしたalert.cssを読み込みます。

// このCSSファイルで、アラートダイアログ内がレイアウトされます。
<link rel="stylesheet"
     href="./alert.css" type="text/css" media="all">


6. Dialog.alertメソッドを実行します。

// モーダルダイアログを表示する
Dialog.alert("モーダルダイアログです。",
        {windowParameters: {width:320, height:100},
        okLabel: "閉じる"
       });




Dialog.alert( string , { option } )


string ダイアログに表示するメッセージ
option 実行時のオプション(全て省略可能)
windowParameters: { width: }
  ダイアログの横幅
  指定例) windowParameters: { width:320 }
windowParameters: { height: }
  ダイアログの横幅
  指定例) windowParameters: { height:100 }
okLabel:
  『OK』ボタンに表示する文字列
  指定例) okLabel: "閉じる"
left:
  ダイアログを表示するX座標
  指定例) left: 0
top:
  ダイアログを表示するY座標
  指定例) top: 0
ok:
  『OK』ボタンが押された時に実行されるメソッド
  指定例) ok: myClickOk
       ↑これでmyClickOkメソッドが実行される buttonClass:
  『OK』ボタンに適用するCSSクラス名
  指定例) buttonClass: myButton



↓インラインフレーム内でサンプルが動作しています。





[Ajax - Prototype Window Class - 画面]



Topページ  >  お勉強  >  Ajax  >  アラートダイアログを表示する 






-