Guest User

Untitled

a guest
Jul 18th, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-…
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5.     <title>Political Decision Engine</title>
  6.     <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  7.     <script>
  8.         $(document).ready(function () {
  9.             $("input[type=checkbox]").change(function (evt) {
  10.                 var isChecked = $(this).is(":checked");
  11.                 var index = $("#my_table input[type=checkbox]").index(this);
  12.  
  13.                 var div = $("#result div").eq(index);
  14.                 console.log(div);
  15.                 console.log(isChecked);
  16.  
  17.                 if (isChecked) {
  18.                     div.show();
  19.                 }
  20.                 else {
  21.                     div.hide();
  22.                 }
  23.             });
  24.         });
  25.     </script>
  26.     <style>
  27.         *
  28.         {
  29.             margin: 0;
  30.             padding: 0;
  31.         }
  32.        
  33.         html
  34.         {
  35.             font: 16px "Segoe UI" , "Segoe WPC" , Helvetica, Arial, "Arial Unicode MS" , Sans-Serif;
  36.         }
  37.        
  38.         div
  39.         {
  40.             float: left;
  41.         }
  42.        
  43.         #result div
  44.         {
  45.             display: none;
  46.             float: none;
  47.         }
  48.     </style>
  49. </head>
  50. <body>
  51.     <form action="" method="post" name="question1" target="_self">
  52.     <table border="1">
  53.         <th colspan="2" align="center" bgcolor="#FF9900">
  54.             Political Decision Engine
  55.         </th>
  56.         <tr>
  57.             <td bgcolor="#F5D69A">
  58.                 Question one:
  59.             </td>
  60.             <td rowspan="4" width="150" bgcolor="#F4DA88">
  61.                 Image goes here
  62.             </td>
  63.         </tr>
  64.         <tr>
  65.             <td bgcolor="#F5E8CB">
  66.                 <table border="1" id="my_table">
  67.                     <tr>
  68.                         <td width="100">
  69.                             <input type="checkbox" name="question_1" />
  70.                             Option 1
  71.                         </td>
  72.                         <td width="100">
  73.                             <input type="checkbox" name="question_1" />
  74.                             Option 2
  75.                         </td>
  76.                         <td width="100">
  77.                             <input type="checkbox" name="question_1" />
  78.                             Option 3
  79.                         </td>
  80.                         <td width="100">
  81.                             <input type="checkbox" name="question_1" />
  82.                             Option 4
  83.                         </td>
  84.                         <td width="100">
  85.                             <input type="checkbox" name="question_1" />
  86.                             Option 5
  87.                         </td>
  88.                     </tr>
  89.                 </table>
  90.             </td>
  91.         </tr>
  92.         <tr>
  93.             <td bgcolor="#F5E8CB">
  94.                 <p id="no-result">Please select a choice</p>
  95.  
  96.                 <div id="result">
  97.                     <div>Enter text for Option 1</div>
  98.                     <div>Enter text for Option 2</div>
  99.                     <div>Enter text for Option 3</div>
  100.                     <div>Enter text for Option 4</div>
  101.                     <div>Enter text for Option 5</div>
  102.                 </div>
  103.             </td>
  104.         </tr>
  105.         <tr>
  106.             <td bgcolor="#F5E8CB">
  107.                 Resourses
  108.             </td>
  109.         </tr>
  110.     </table>
  111. </body>
  112. </html>
Advertisement
Add Comment
Please, Sign In to add comment