[note] Today because you see the front-end of the JS page and HTML page, feel the need to familiarize themselves with their basic grammar, so spent a day to review to consolidate a bit (previously studied), including HTML syntax, CSS syntax, JavaScript syntax, objects, BOM (Browser object model), JSON (JavaScript Object notation) PS: Understand the basic usage, probably can see the simple statement, does not reach the level of practicality.
One: Completed today
1) HTML
tags, elements and attributes
Heading paragraph bold italic Delete effect underline
Various box and buttons
2) CSS
Syntax for CSS
selector {Property:value}
That is, the selector {property: value}
Learn CSS to learn what selectors, which properties, and what values you can use
Various layouts (dizziness)
3) JAVASCRIPT
JavaScript is used for the interaction between Web pages and users, such as when committing, whether the user name is empty.
The complete JavaScript consists of a language base, a BOM, and a DOM.
Five basic objects and custom objects
4) BOM
BOM is the Browser object model (brower)
Browser objects include
Window (Windows)
Navigator (browser)
Screen (client screens)
History (Visit historical)
Location (browser address)
5) JSON
The JSON JavaScript Object notation (JavaScript Object Notation) is a way to store data.
Creating a JSON Object
Accessing JSON objects
Creating a JSON array
Accessing JSON arrays
JSON objects and JavaScript objects
String to JSON object
Second, tomorrow's plan
A little bit more about ajax,jquery tomorrow, BootStrap (really just understand)
Three: Difficult problems
Because the front-end language is WYSIWYG, there are few problems with tutorials on the web,
Four: Thinking Summary
See JS syntax when found and Java is a little bit similar to the place,
<
script
>
function p(s){
document.write(s);
document.write("<
br
>");
}
p("协议 location.protocol:"+location.protocol);
p("主机名 location.hostname:"+location.hostname);
p("端口号 (默认是80,没有即表示80端口)location.port:"+location.port);
p("主机加端口号 location.host:"+location.host);
p("访问的路径 location.pathname:"+location.pathname);
p("锚点 location.hash:"+location.hash);
p("参数列表 location.search"+location.search);
</
script
>
<
script
>
var s1 = "{\"name\":\"盖伦\"";
var s2 = ",\"hp\":616}";
var s3 = s1+s2;
document.write("这是一个JSON格式的字符串:" + s3);
document.write("<
br
>");
var gareen = eval("("+s3+")");
document.write("这是一个JSON对象: " + gareen);
</
script
>
<
html
>
用户名 <
input
name
=
"userName"
> <
br
>
密码 <
input
name
=
"userPassword"
>
<
br
>
<
script
>
var elements= document.getElementsByName("userName");
for(i=0;i<
elements.length
;i++){
document.write(elements[i]);
document.write("<br>");
}
</
script
>
</
html
>
Getelementsbyname, the Tag property is worth the tag, don't you know? There is this usage, but it is not recommended to use it at work.
Because he can't locate the only one like getElementById.
It is also not possible to get pre-categorized elements like Getelementsbyclassname.
Further explanation, the name attribute is used to be submitted to the server, if the server code is adjusted, name needs to be adjusted, the corresponding getelementsbyname also need to make synchronous changes to ensure normal operation, which increases the maintenance cost and the chance of error.
The ID and class in getElementById and Getelementsbyclassname only appear on the front-end page, not on the backend, compared to the increase in the potential maintenance costs. NodeType represents the value of the type of a node ', otherwise it is easy to confuse the concept of "node value (nodevalue)"
HTML, CSS, JavaScript, JSON;