Sunday, September 17, 2017

Output (hiển thị dữ liệu)

JavaScript can "display" data in different ways:
  • Writing into an HTML element, using innerHTML.
    • sử dụng phương thức document.getElementById(id)
  • Writing into the HTML output using document.write().
    • nếu hàm này được thực hiện sau khi page đã load xong, nó sẽ xóa toàn bộ dữ liệu html trong page 
    • vì vậy nên chỉ sd để testing
  • Writing into an alert box, using window.alert().
    • hiển thị dl sd hộp thoại cảnh bảo alert box
  • Writing into the browser console, using console.log().
    • sửdụngđểdebugging

No comments:

Post a Comment