PHP & JavaScript Room :: 設置サンプル

実行結果

設置サンプル

参照: jQDialog plugin for jQuery

設置サンプルのソース

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <meta http-equiv="Content-Language" content="ja" />
      <meta http-equiv="Content-Script-Type" content="text/javascript" />
      <meta http-equiv="Content-Style-Type" content="text/css" />
      <meta http-equiv="imagetoolbar" content="no" />
      <title>設置サンプル</title>
      <link rel="stylesheet" type="text/css" href="/content/lib/global.css" />
      <!-- JS -->
      <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
      <script type="text/javascript" src="/content/lib/jquery/jqdialog.js"></script>
      <script type="text/javascript">
         $(function(){
            /* 警告ダイアログ */
            $('#bt-notify').click( function() { jqDialog.notify("このダイアログは3秒後に自動的に消えます。", 3); } );
            
            /* アラートダイアログ */
            $('#bt-alert').click(function() {
               jqDialog.alert("アラートダイアログです。", function() {
                  /* 【OK】ボタンがクリックされた時に呼ばれるコールバック関数 */
                  alert("【OK】ボタンがクリックされました!");
               });
            } );
            /* 入力プロンプト */
            $('#bt-prompt').click( function() {
               jqDialog.prompt("名前を入力してください。",
                  'ほげ',
                  /* 【OK】ボタンがクリックされた時に呼ばれるコールバック関数 */
                  function(data) { alert("アナタの名前は「" + data + "」ですね!?"); },
                  /* 【CANCEL】ボタンがクリックされた時に呼ばれるコールバック関数 */
                  function() { alert("【CANCEL】ボタンがクリックされました!"); }
               );
            } );
            /* 確認ダイアログ */
            $('#bt-confirm').click( function() {
               jqDialog.confirm("どちらかのボタンをクリックしてください。",
                  /* 【YES】ボタンがクリックされた時に呼ばれるコールバック関数 */
                  function() { alert("【YES】ボタンがクリックされました!"); },
                  /* 【NO】ボタンがクリックされた時に呼ばれるコールバック関数 */
                  function() { alert("【NO】ボタンがクリックされました!"); }
               );
            } );
            
            /* カスタムコンテンツダイアログ */
            $('#bt-content').click( function() {
               jqDialog.content('<p><label for="userid">ユーザーID:</label><input type="text" name="userid" id="userid" /></p><p><label for="userpw">パスワード:</label><input type="password" name="userpw" id="userpw" /></p>');
            } );
         });
      </script>
      <!-- CSS -->
      <style type="text/css">
         #jqDialog_box {
            background: #eee;
            position: absolute;
            width: 450px; height: 150px;
            border-width: 3px 1px 1px 1px;
            border-style: solid;
            border-color: #ccc;
            -moz-border-radius: 6px;
            -webkit-border-radius: 6px;
         }
         #jqDialog_content {
            margin: 10px;
            font-weight: bold;
            font-size: 12px;
            height: 90px;
            overflow: hidden;
         }
         #jqDialog_options {
            margin: 10px;
            text-align: center;
         }
         #jqDialog_options button {
            font-family: Arial;
            margin-right: 5px;
            background: #666;
            border: 0px;
            font-size: 1.5em;
            color: #fff;
            width: auto;
         }
         #jqDialog_input {
            padding: 4px;
            width: 250px;
         }
         #jqDialog_close {
            background: none;
            border: none;
            float: right;
            font-weight: bold;
            font-size: 10px;
            color: #cc0000;
         }
      </style>
   <link rel="stylesheet" type="text/css" href="/common/css/example.css"></head>
   <body id='example3' class='example'><div class="ads" style="margin:32px auto;text-align:center;"></div><h1 class='h'><a href='/'>PHP &amp; JavaScript Room</a> :: 設置サンプル</h1>
<h3 class='h'>実行結果</h3>
      <div id="wrap">
         <h1>設置サンプル</h1>
         <p>参照: <a href='http://kailashnadh.name/code/jqdialog/'>jQDialog plugin for jQuery</a></p>
<!-- CODE -->
         <p>
            <button id="bt-notify">警告ダイアログ</button>
            <button id="bt-alert">アラートダイアログ</button>
            <button id="bt-confirm">確認ダイアログ</button>
            <button id="bt-prompt">入力プロンプト</button>
            <button id="bt-content">カスタムコンテンツダイアログ</button>
         </p>
<!-- / CODE -->
      </div>
   </body>
</html>