HTML and CSS Reference
In-Depth Information
web app according to the accompanying actions. Using JavaScript, you can handle
button clicks, page loads, apply addition styling, add special effects, or even fetch
data from web services. Using JavaScript, you can create objects, assign them prop-
erties and methods, and raise and catch events when something occurs.
Following is a simple JavaScript example:
var buttonSend =
document.getElementById("send-button");
buttonSend.onclick = function() {
console.log("Button clicked!");
}
The first line searches the document tree, finds the element named action-but-
ton and stores it in an object named buttonSend . Then, a function is assigned to
the onclick event of the button. The body of the function is executed every time the
button is clicked on.
The brand-new HTML5 features are heavily based on JavaScript, so a basic know-
ledge of this language is essential before implementing any web app. Most import-
antly, the WebSocket API is pure JavaScript, too!
Search WWH ::




Custom Search