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> <button onclick="myFunction()">Run</button> <p id="demo"></p> <script> function myFunction() { var content = 'góc có số đo 0 radians có cosine = ' + Math.cos(0) + '<br>'; content = content + 'góc có số đo 3.14 radians có cosine = ' + Math.cos(3.14) + '<br>'; content = content + 'góc có số đo 1.77 radians có cosine = ' + Math.cos(1.77) + '<br>'; content = content + 'góc có số đo abc radians có cosine = ' + Math.cos('abc') + '<br>'; document.getElementById("demo").innerHTML = content; } </script> </body> </html>
PHÓNG TO