1. DOCTYPE html> 
  2. <html> 
  3. <head> 
  4. <meta charset="UTF-8"
  5. <title>Insert title here</title> 
  6. <style> 
  7. span.a {font-size:30px; color:red; display:block;} 
  8. span.b {font-size:10px; color:blue;} 
  9. </style> 
  10. </head> 
  11. <body> 
  12. <div id="result"></div> 
  13. <script> 
  14. var userInput = ""
  15. while(true) { 
  16. userInput = prompt('please enter your full name',''); 
  17. comma = userInput.indexOf(","); 
  18. spacepos = userInput.indexOf(" "); 
  19. if(comma !== -1) alert("Please enter your FULL NAME without COMMA"); 
  20. if(spacepos === -1) alert("Please enter your FULL NAME with blank"); 
  21. if(comma === -1 && spacepos !== -1) { 
  22.     var t = '<span class="</span>a<span class="txt">">' + (userInput.split(" ")[1]).toUpperCase() + '</span>' 
  23.     + '<span class="</span>b<span class="txt">">' + (userInput.split(" ")[0]).toLowerCase() + '</span>'
  24.     document.getElementById("result")[removed] = t; 
  25.     alert("good"); 
  26.     break
  27. </script> 
  28. </body> 
  29. </html> 

지식in성님과 프갤의 힘을 빌린결과 이게 제일정확한거같고 실험해본결과 잘 작동하는데여

이걸 그대로 내가면 선생이 어디다 물어보고 배껴왔냐고 학점안줄정도로.... 잘작동함...

선생이 가르치지않은 코드도 많아서...

span코드를 사용하지않고 성,이름을 다른 색깔 다른 크기로 출력시키려면 여기서 어떻게바꿔야되나여?

저는 그냥 <font size=+2>쓰고 </font>로 끝내려했는데 생각해보니 성이름을 다른색깔과 크기로 출력해야되네여...

초보티 내려면 어케해야되져 ㅋㅋㅋㅋㅋㅋㅋ