Python goes all the way to HTML CSS Javascript

Source: Internet
Author: User
Tags html header throw exception

three sharp tools on the front HTML-Tags (in pairs write not easy to forget to close) self-closing and label tags write a xx=xx, indicating the properties of the tag<!— — > commentsHead:Meta (metadata information)Provides meta-information about pages, such as page encodings, refreshes, jumps, descriptions of search engine and update frequency, and keyword 1. Page encoding (Tell the browser what encoding) < meta http-equiv= "Content-type" content= "Text/html;charset=utf-8" ><meta charset= "UTF-8" >2 Refresh and Jump < meta http-equiv= "refresh" content= "30″>< meta http-equiv=" Refresh "content=" 5; url=http://www.autohome.com.cn "/>3 keywords < meta name=" keywords "content=" StarCraft 2, star old boy, interview, F91, small color, JOY "> 4 Description For example: CNBLOGS5 x-ua-compatible <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />Title

Web header information

LinkCSS < link rel= "stylesheet" type= "Text/css" href= "Css/common.css" >icon (Title box) < link rel= "shortcut i Con "href=" Image/favicon.ico ">Style

Write a style on a page

For example:
< style type= "Text/css" >
. bb{
background-color:red;
}
</style>
ScriptIntroduction file < script type= "Text/javascript" src= "Http://www.googletagservices.com/tag/js/gpt.js" > </script > Write JS code < script type= "Text/javascript" > ... </script > HTML Common tags h,p,br:id a:id href Target Div:idApproximate classification:Block label (self-occupied line)Nellian (in-line) label (how much is the content)Special symbols have special code to show http://www.cnblogs.com/web-d/archive/2010/04/16/1713298.html Tags: paragraph: <p></p>Line break: <br/> Properties:<a href= "Http://www.sohu.com" ></a> <a hred= "http://www/sohu.com" target= "_blank" > Jump 2</a>A anchor <a href= "#i1" ></a> (Look for the Id=i1 tab in the page, place its label at the top of the page, ID does not allow duplicates) title: H1 H2 .... H6 tags can be nested<input/> Series Tags: Textpasswordradiocheckboxfilebutton button submit current form value: Display word reset reset form <sel Ect>-option with value when submitting, you can save-optgroup<textarea>-multiline text <form>action= "url"The content to be submitted is placed in the Form tab to upload the file note plus: enctype= "Multipart/form/data"         <form action= "Https://www.sogou.com/web" method= "get" > <input type= "text" name= "query"/> <input type = "Submit" value= "Commit"/>
name is equivalent to commit key:value, name is key, input is valueTo write value when submitting a choice such as Checkbox,radio, an unpredictable error will occur by default<label for= "" > Associated cursor IDul<li>,ol<li>,dl<dt><dd> table:colspan Merge Unit rowspan merge unit <table border= "1" >
<thead>
<tr>
<th> first column </th>
<td> second column </td> </tr>
</thead>
<tbody> <tr>
<td> first column </td> <td> second column </td> </tr>

</tbody><table/>fieldsetIframe CSSPresence form: Priority: Tag Properties >html header (<style>) > standalone file. css (link reference)Selector SelectorTag Selector div Selector ID Selector class Selector Hierarchy Selector Combo Selectorstyle<style>
. c1{
color:red;
Background-color:aqua;
font-size:32px;
height:150px;
width:500px;
}
. img{
Background-image:url ("4.gif");
height:150px;
width:500px;
/* The hole in the picture can be seen */
Background-repeat:no-repeat;
background-position:84px-58px;
}

</style>
Borderborder (-top/left/right bottom) px solid/dotted/color Show DisplayDisplay:none(hide tag)Display:block (inline variable block level)Display:inline (block-level variable internal connection)Pure Inline Label height width does not take effectOne, "no block-level scope in JavaScript"

There is a block-level scope in Java or C #, which is: curly braces are also a scope.

JavaC #

No block-level scopes in the JavaScript language

1234567 function  main () { &NBSP;&NBSP;&NBSP;&NBSP; if (1==1) {           var  name =  ' seven ' &NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP; console.log (name); //output: Seven

Add: The title adds double quotes because the LET keyword is introduced in JavaScript6 to specify that the variable belongs to a block-level scope.

Second, JavaScript uses function scope

In JavaScript each function acts as a scope, and the variables in the internal scope cannot be accessed externally.

123456789 functionMain(){    var innerValue = ‘seven‘;} Main(); console.log(innerValue);// 报错:Uncaught ReferenceError: innerValue is not defined
Third, the scope chain of JavaScript

Because each function in JavaScript acts as a scope, the scope chain appears if function nesting functions occur.

1234567891011 xo = ‘alex‘; functionFunc(){    varxo = "seven";    function inner(){        varxo = ‘alvin‘;        console.log(xo);    }    inner();}Func();

As shown above, there are three scopes of scope chain, if the scope chain, then the search for variables will appear in order, for the above example:

When executing Console.log (XO), its search order is based on the scope of the chain from the inside to the outside of the priority, if the inner layer does not step up to find, until the throw exception is not found.

Iv. The scope chain of JavaScript was created before execution

The scope of JavaScript is created before it is executed, and it is only necessary to follow the scope chain to find out when to execute it later.

Example one:

1234567891011121314 xo = ‘alex‘;functionFunc(){    varxo = "seven";    functioninner(){        console.log(xo);    }    returninner;}var ret = Func();ret();// 输出结果: seven

The above code, before the function is called, the scope chain already exists:

    • Global scope, Func function scope, inner function scope

When executing "ret ();", because its surrogate refers to the inner function, the scope chain of this function has been defined before execution: global scope, Func function scope, and inner function scope, so, when executing "ret ();", The variable is searched based on the existing chain of scopes.

Example two:

123456789101112131415 xo = ‘alex‘;functionFunc(){    varxo = "eirc";    functioninner(){        console.log(xo);    }    xo = ‘seven‘;    returninner;}varret = Func();ret();// 输出结果: seven

The code above is the same as example one, and it also emphasizes that the scope chain already exists before the function is called:

    • Global scope, Func function scope, inner function scope

At different time, the value of the XO variable in the FUNC scope has been reset from "Eric" to "seven" when executing "var ret = Func ();", so you can only find "seven" when you Execute "ret ()".

Example three:

1234567891011121314 xo = ‘alex‘;<br>functionBar(){    console.log(xo);}functionFunc(){    varxo = "seven";        returnBar;}varret = Func();ret();// 输出结果: alex

The code above has created two scope chains before the function is executed:

    • global scope, bar function scope
    • Global scope, Func function scope

When performing "ret ();", the RET surrogate refers to the bar function, and the bar function's scope chain already exists: global scope--bar function scope, so execution will be based on the existing scope chain to find.

V. Declaration of Advance

In JavaScript, if you do not create a variable and go directly to it, the error is:

12 console.log(xxoo);// 报错:Uncaught ReferenceError: xxoo is not defined

If you create a value without assigning a value in JavaScript, the value is undefined, such as:

123 varxxoo;console.log(xxoo);// 输出:undefined

Within the function, if you write this:

1234567 functionFoo(){    console.log(xo);    var xo = ‘seven‘;}Foo();// 输出:undefined

The above code, not error, but output undefined, the reason is: the JavaScript function before it is executed, the variables are all declared, without assigning value. Therefore, the equivalent of the above example, the function in "precompiled" when the Var XO has been executed, so the above code output is undefined.

Python goes all the way to HTML CSS Javascript

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.