StefiIOE

lab4.2

Feb 10th, 2020
163
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.   <meta charset="UTF-8">
  5.   <title>zadaca2</title>
  6.   <style>
  7.     label{
  8.       display: inline-block;
  9.       width: 50px;
  10.       padding: 0px 0px 9px 0px;
  11.     }
  12.     #selektor{
  13.       width: 160px;
  14.     }
  15.     button{
  16.       display: inline-block;
  17.       margin-left: 140px;
  18.     }
  19.   </style>
  20. </head>
  21. <body>
  22. <div>
  23.   <label>Items</label><input type="text" id="items"><br>
  24.   <label>Type:</label><select id="selektor"><br>
  25.   <option value="radio">Radio button</option>
  26.   <option value="checkbox">Check-box</option>
  27. </select><br>
  28.   <button onclick="prikazi();">Прикажи</button>
  29. </div>
  30. <div>
  31.   <div id="show" ></div>
  32. </div>
  33. </body>
  34. </html>
  35.   <script>
  36.     function prikazi() {
  37.       document.getElementById('show').innerHTML = "";
  38.       var number = [];
  39.       var items = document.getElementById('items').value;
  40.       number = items.split(",");
  41.       var dodadi = document.getElementById('show');
  42.  
  43.       var kakov = document.getElementById('selektor').value;
  44.  
  45.       for(var i=0; i<number.length; i++){
  46.         dodadi.innerHTML = dodadi.innerHTML + "<input type="+kakov+">" + number[i] + " ";
  47.       }
  48.     }
  49.   </script>
RAW Paste Data