私はこのチュートリアルと設計された警告ウィンドウ(オンラインデモを含む)、
http://jquerytools.org/demos/overlay/modal-dialog.htmlに従っています
ソース コードを変更して、アラート メッセージにラジオ ボタンを追加することもできます。ソースコードは次のとおりです (コード全体を確認する必要はありません。ラジオ ボタンを追加した場所と、値にアクセスする場所を参照してください)。ラジオボタンの)、
<!DOCTYPE html>
<html>
<!--
   This is a jQuery Tools standalone demo. Feel free to copy/paste.
   http://flowplayer.org/tools/demos/
   Do *not* reference CSS files and images from flowplayer.org when in
   production Enjoy!
-->
<head>
  <title>jQuery Tools standalone demo</title>
    <!-- include the Tools -->
  <script src="jquery.tools.min.js"></script>
  <!-- standalone page styling (can be removed) -->
  <link rel="shortcut icon" href="/media/img/favicon.ico">
  <link rel="stylesheet" type="text/css"
        href="/media/css/standalone.css"/>
  <style>
    .modal {
    background-color:#fff;
    display:none;
    width:350px;
    height:250px;
    padding:15px;
    text-align:left;
    border:2px solid #333;
    opacity:0.8;
    -moz-border-radius:6px;
    -webkit-border-radius:6px;
    -moz-box-shadow: 0 0 50px #ccc;
    -webkit-box-shadow: 0 0 50px #ccc;
  }
  .modal h2 {
    background:url(/media/img/global/info.png) 0 50% no-repeat;
    margin:0px;
    padding:10px 0 10px 45px;
    border-bottom:1px solid #333;
    font-size:20px;
  }
  </style>
</head>
<body><!-- the triggers -->
<p>
  <button class="modalInput" rel="#yesno">Yes or no?</button>
  <button class="modalInput" rel="#prompt">User input</button>
</p>
<!-- yes/no dialog -->
<div class="modal" id="yesno">
  <h2>This is a modal dialog</h2>
  <p>
    You can only interact with elements that are inside this dialog.
    To close it click a button or use the ESC key.
  </p>
  <!-- yes/no buttons -->
  <p>
    <button class="close"> Yes </button>
    <button class="close"> No </button>
  </p>
</div>
<!-- user input dialog -->
<div class="modal" id="prompt">
  <h2>This is a modal dialog</h2>
  <p>
    You can only interact.
  </p>
  <!-- input form. you can press enter too -->
  <form>
    //Added radio buttons
    <input type="radio" name="sex" value="male" id="male"> Male<br />
    <input type="radio" name="sex" value="female" id="female"> Female<br />
    <button type="submit">Submit</button>
  </form>
  <br />
</div>
<script>
$(document).ready(function() {
    var triggers = $(".modalInput").overlay({
      // some mask tweaks suitable for modal dialogs
      mask: {
        color: '#ebecff',
        loadSpeed: 200,
        opacity: 0.9
      },
      closeOnClick: false
  });
    var buttons = $("#yesno button").click(function(e) {
      // get user input
      var yes = buttons.index(this) === 0;
      // do something with the answer
      triggers.eq(0).html("You clicked " + (yes ? "yes" : "no"));
  });
    $("#prompt form").submit(function(e) {
      // close the overlay
      triggers.eq(1).overlay().close();
      // get user input
      var input = $("input", this).val(); // this input value always return 'male' as the output  
      // do something with the answer
      triggers.eq(1).html(input);
      // do not submit the form
      return e.preventDefault();
  });
  });
</script>
</body>
</html>
このデモには 2 つのアラート ウィンドウがあります。テキスト入力のある警告メッセージについて話しています。私の例では、テキスト入力を削除し、2 つのラジオ ボタンを追加しました。
しかし、「送信」ボタンをクリックすると、出力として常に「男性」が返され
ます 誰でもこの問題を解決するのを手伝ってもらえますか? ラディンボタンの出力を変数「入力」に取得する必要があります