Ví dụ
RUN
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> <h1>Học lập trình miễn phí tại freetuts.net</h1> <label>Score</label> <input type="text" name="score" id="score" > <p id="result"></p> <button onclick="myFunction()">Kiểm tra</button> <script> function myFunction() { var score, skill; score = document.getElementById("score").value; skill = (score > 50) ? "good":"bad"; document.getElementById("result").innerHTML = 'your skill is ' + skill; } </script> </body> </html>
PHÓNG TO