1.javascript weakly typed language, explanatory language.2.javascript data type: string (string), number,Boolean (boolean), Array, object ( Object), null (null), undefined (Undefined).JavaScript built- in objects and user-defined objects . Host object (provided by the browser)3. Array index subscript starting from 0.4. Function: Use the same piece of code multiple times!Name of variable: multiple words using underline temp_celsius;Name of function: Hump rule oh;5.return false: Block The jump of
Involves the Quick access key (accesskey property) feature:Add the following code to the HTML page:Ape Group Education " accesskey= "1" >HomeJS Add a method to display:function Displayaccesskeys () {if (!document.getelementsbytagname | |!document.createelement | |! document.createTextNode) return false; var ul = document.getElementById ("navigation"); var links = ul.getelementsbytagname ("a"); var Akeys = new Array (); for (Var i=0;iNote: JavaScript scripts should only be used
Last Updated 2016-04-02 16:14:06
Objective:This section tells you how to dynamically insert content into HTML by using JSP syntax to change the existing content of HTML.If we dig deeper into the DOM tree, we know that HTML content actually exists as a node tree, changing the content, that is, adding a new node to the node tree.Of course, we use JSP to add content to the Web page, and will not change the original HTML document
Two important functions for creating a nodeCreateelemnt ("
Dom Method:1, createelementSyntax: document.createelement (nodeName)For example: Document.createelement ("P"); A P element is created;2, AppendChildSyntax: Parent.appendchild (Child)3, CreattextnodeSyntax: document.createTextNode (text)Example.js/*window.onload = function () {var para = document.createelement ("P"); var testdiv = document.getElementById ("Testdiv"); Testdiv.appendchild (para); var txt = document.createtextnode ("Hello World"); Para.appendchild (TXT); Note that there is
HTML5 of the vedio and audio elements, the compatibility of the two are very good at present, so when writing to consider the alternatives;HTML5 form elements: email, url, data, number, range, search, tel, colorLet's put a small example of a canvas below:DOCTYPE HTML>HTML>Head>Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8">title>Small instance of Canvastitle>Head>Body>CanvasID= "Draw-in-me"width= "+"heigt= "Max">P>Powered by HTML5 CanvasP>Canvas>Script> functionDraw () {varCan
, you can add window.onload = Preparelinksbefore; Package The above functions in the Preparelinks () function
Summarize:JSP function triggered dynamically, by adding functions to the event handler to implement the real-time control of the Web pageIn fact, it is possible to judge that an HTML document object is manipulated in that almost all operations areWindow.onload = function{Func1 ();Fun2 ();.....}With the full DOM in order to have the document object, we get the element object that se
();Func ();}}}6. The parties also do not have DOM methods and properties to insert a node behind another node. A brief introduction to the following InsertAfter () function:function InsertAfter (newelement,targetelement) {var parent = Targetelement.parentnode;if (Parent.lastchild = = targetelement) {Parent.appendchild (newelement);}else{Parent.insertbefore (newelement,targetelement.nextsibling);}}7. Remember that JavaScript script values should be used to enrich the content of the document, avo
Question: When clicking on an image link, you can see both the picture and the original picture list on the current pageWorkaround: Add a placeholder to reserve a browse area for the picture1, add a placeholder after the list2, change the SRC attribute of the placeholderfunction Showpic (whichpic) {var Placeholder=document.getelementbyid ("placeholder");//Get the contents of the IMG element through the id attributevar source=whichpic.getattrribute ("src");//Gets the value of the SRC attribute of
12th Chapter1. This chapter is a comprehensive example of everything in the preceding chapters2. Process: ① Project Introduction:A. get the original material (including text, pictures, audio and video, etc.)B. site structure (file directory structure)C. page (file) structure② design (cut chart)③css-base.css for introducing the CSS file usedCOLOR.CSS- used to set styleLAYOUT.CSS- used to set the layoutTYPOGRAPHY.CSS- used to set the layout3. digression: ① in the actual development, even a blank p
Tenth Chapter1. In the animation, because js efficiency is high, so the transition effect is not visible2. Off-topic: ① Foreign people write books, always first thanks to friends and family, finally thanks to their families.3. "Unless you allow users to ' freeze ' mobile content, you should avoid moving content around the page"4. Animations often encounter problems: moving the mouse back and forth, the animation will be a problem.Cause: Queue events accumulate.Resolution: Determines that if ther
CAS has two features:1. For loop2, Compareandset (possibly other threads change and then reset, at this time the CAS is successful, that is, the process of CAs execution, it is possible for multiple threads to modify this variable, rather than the individual thread mutually exclusive modification )3, CAs and mutexes are different, CAs can be successfully executed by multiple threads at the same time.Thread.Join ()Here is the source code. A.jonin (b), so when B ends, it notifya, How does it happe
are other threads competing for this lock, the bias mode is declared closed. 5.Lightweight lockLightweight Lock-Lock: Before the thread executes the synchronization block, the JVM creates space in the stack frame of the current thread to store the lock record and copies Mark word in the object header to the lock record, officially known as displaced Mark Word. The thread then attempts to replace Mark Word in the object header with a pointer to the lock record using CAs. If successful, the curre
HTML document divided into element node attribute node text nodeGet element node Dom method: getElementById getElementsByTagName GetelementsbyclassnameTo create an element node method: createelementInsert a node method: AppendChildWays to get attribute nodes: getattributeWays to change attribute nodes: SetAttributeGet all the child elements of an element: ChildNodesGet the properties of a node: The NodeType element node is 1 the attribute node is 2 the text node is 3 nodeType total 12 kinds of v
1. StatementsHave each statement exclusive to a single line, with a semicolon at the end of each statement2. Annotation method:1, single-line comment \ \2. Multiline comment/* */3. VariablesVariables in JScript can be declared without being directly used such as: mood= "Happy";Variable names and other element names are case sensitive4. Data type (scalar)Weak type1. StringSingle quotation mark, double quote escape character \The use of quotation marks remains consistent throughout the script2. Va
Addloadevent (func) {Deposit the existing processing function value into Oldonloadvar oldonload=window.onload;If no function has been bound, add func to itif (!typeof oldonload!= "function") {Window.onload=func;}If the function is already bound, the new function is appended to the endelse{Window.onload=function () {Oldonload ();Func ();}}}DOM Core and Html-dom:getElementById getElementsByTagName getattribute setattribute are Dom Core, they are not specifically JavaScript, and any DOM-enabled la
syntax does not allow a variable name to contain spaces or punctuation (the dollar sign "$" exception)JavaScript variable names are allowed to contain letters, numbers, dollar signs, and underscores (but the first character is not allowed to be a number)Hump format naming:Remove Middle white space (underline), followed by each new word start with uppercase letters Script > var ="happy"; Script >Usually the hump format is the preferred format for function name, method name, and object prope
){ varPara = document.createelement ("P"); varTXT =document.createTextNode (Request.responsetext); Para.appendchild (TXT); document.getElementById (' New '). AppendChild (para); } }; Request.send (NULL); } Else{alert (' Sorry,your browser doesn\ ' t support XMLHttpRequest '); }}addloadevent (getnewcontent);When the page load is complete, the above code initiates a GET request to load the Exemple.txt fileRequest.open ()The onreadystatechange in the code
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.