관리 메뉴

nalaolla

prompt 본문

javascript/fundamental

prompt

날아올라↗↗ 2016. 1. 7. 13:39
728x90
반응형
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Insert title here</title>
  6. <script type="text/javascript">
  7.     window.onload = function() {
  8.         var strName = prompt("What's your name?", "");
  9.  
  10.         if (strName == "yangssem") {
  11.             alert("Your name is "+strName+"! Good for you!");
  12.         } else {
  13.             alert("Your name isn't "+strName+". Bummer.");
  14.         }
  15.     }
  16. </script>
  17. </head>
  18. <body>
  19.  
  20. </body>
  21. </html>


728x90
반응형

'javascript > fundamental' 카테고리의 다른 글

indexOf  (0) 2016.01.07
type  (0) 2016.01.07
onload  (0) 2016.01.07