Js front end of a brief introductory knowledge --JavaScript

JavaScript is one of the most popular programming languages.

Ideal for web programming such as HTML elements of the page operation.

A .JavaScript Features:

(1) It is a scripting language.

(2) It is a lightweight programming language.

(3) .JavaScript code may be directly inserted into the HTML element.

(4) to the browser as a runtime environment.

II learned from this tutorial:

(1) .JavaScript grammar.

(2) .JavaScript operation DOM elements.

(3) .JavaScript operations on the browser object.

.JavaScript of three components:

JavaScript is the norm in the browser specific implementation ECMAScript.

ECMAScript is a standard, the most basic definition of a code of conduct, regardless of the particular host environment that provides core programming capability for different host environment, with no user interaction function. In addition to the browser's JavaScript, Flash and Director MX ActionScript also of its implementation.

JavaScript runtime environment is the browser, expand operations related to the browser window object (referred to as BOM). document objects (referred to as DOM objects) belonging to the window object, but because JavaScript is the core operation of the document, it is usually independent of its introduction. JavaScript it can be considered as composed of three parts:

** here ** Insert Picture Description

Four code examples:

<!DOCTYPE html> 
<html> 
<head> 
<meta charset="utf-8"> 
<meta name="author" content="http://www.softdewhy.com/" /> 
<title>兴趣部落</title>
<style>
div {
  width:100px;
  height:100px;
  background-color:#ccc;
}
</style>
<script>
window.onload = function () {
  var obt = document.getElementById("bt");
  var odiv = document.getElementById("ant");
  obt.onclick = function () {
    odiv.style.backgroundColor = "red";
  }
}
</script>
</head> 
<body>
<div id="ant"></div>
<input type="button" id="bt" value="查看演示"/>
</body>
</html>

The background color of the div element can be set to red; this is the most basic element of dom operation.

<!DOCTYPE html> 
<html> 
<head> 
<meta charset="utf-8"> 
<meta name="author" content="http://www.softdewhy.com/" /> 
<title>兴趣部落</title>
<style>
div {
  width:400px;
  height:100px;
  background-color:#ccc;
}
</style>
<script>
window.onload = function () {
  var obt = document.getElementById("bt");
  var odiv = document.getElementById("ant");
  obt.onclick = function () {
    odiv.innerHTML = location.href;
  }
}
</script>
</head> 
<body>
<div id="ant"></div>
<input type="button" id="bt" value="查看演示"/>
</body>
</html>

URL address of the current page can be written div, DOM manipulation involving not only here, but also operations related to the BOM.

Finally, I recommend a push in the front-end learning exchange group 685 910 553 Advanced ( front-end information-sharing ), no matter which direction you are on Earth,
whether you are welcome to work in a few years you settled in! (Within the group regularly offer free collection of some of the main group of free learning materials and books tidied face questions and answers document!)

If you have any objection to this article, then please write your comments in the article comments at.

If you find this article interesting, please share and forward, or you can look at, you acknowledge and encouragement of our articles.

Wish everyone in the programming this road, farther and farther.

Guess you like

Origin blog.csdn.net/tianduantoutiao/article/details/90813219