Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.45 KB | None | 0 0
  1. <!Doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5.     <title>Szotingersv2</title>
  6. </head>
  7. <body>
  8. <form onsubmit="return false">
  9.     Imie:<input type=text id=imie required><br>
  10.     Nazwisko:<input type=text id=nazwisko required><br>
  11.     <select id=list name=list>
  12.         <option value=1>1</option>
  13.         <option value=2>2</option>
  14.     </select><br>
  15.     <button onClick=a()>Wyslij</button>
  16.  
  17.     </form>
  18. <script>
  19.     function a(){
  20.         var imie=document.getElementById("imie").value;
  21.         var nazwisko=document.getElementById("nazwisko").value;
  22.         var list=document.getElementById("list").value;
  23.    
  24.        
  25.         if(imie!==""&&nazwisko!==""&&list==1){
  26.           document.getElementById("wynik").innerHTML=("<img src='1.jpg' id='zdj' onClick='b()'><br>Wysokość:<input type='text' id='w' >Szerokość:<input type='text' id='h'>");
  27.         }
  28.         if(imie!==""&&nazwisko!==""&&list==2){
  29.             document.getElementById("wynik").innerHTML=("<img src='2.jpg'>");
  30.     }
  31.     }
  32.     function b(){
  33.          var h=document.getElementById("h").value;
  34.         var w=document.getElementById("w").value;
  35.         if(w>=50&&h>=50){
  36.  
  37.        document.getElementById("wynik").innerHTML=("<img src='1.jpg' width='"+w+"px'height='"+h+"px'>");
  38.         }
  39.         else{
  40.             document.getElementById("wynik").innerHTML="Nie jest wieksze nic 50";
  41.         }
  42.     }
  43.  
  44.    
  45.     </script>
  46.     <div id=wynik></div>
  47. </body>
  48. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement