Three ways to use :
Put in the
Put in the
Placed in an external JS file
Three ways to output data:
Use the document.write () method to write content to an HTML document.
Use the Window.alert () pop-up warning box.
Writes to an HTML element using InnerHTML.
Use the ID property to identify the HTML element.
Use the document.getElementById (ID) method to access HTML elements.
Use innerHTML to get or insert elem
. But under normal circumstances this cannot be done. The only workaround is to define a function inside the function. An external variable cannot access an internal variable, but an internal variable can access an external variable, which is precisely because of the "chain Scope" structure (chain scope) that is unique to JS, and the child object looks up the variables of all the parent objects first-level. So all the variables of the parent object are visible to the child object, and vice versa
===undefined){ Array.prototype.some=function(fun){ for(var i=0;i
The browser does not support the map attribute, the map implementation principle if(Array.prototype.map===undefined){ Array.prototype.map=function(fun){ //创建空数组: newArr var newArr=[]; //遍历当前数组中每个元素 for(var i=0;i
If the browser does not support the reduce attribute, the implementation principle of reduce if(Array.prototype.reduce===undefined){ Array.prototype.reduce=function(fun,base){
will be executed after the get operation is completed.Program Demo:1 DOCTYPE HTML>2 HTML>3 4 Head>5 MetaCharSet= "Utf-8">6 title>callback functiontitle>7 Scriptsrc= "Jquery/jquery-2.1.4.js"type= "Text/javascript"CharSet= "Utf-8">Script>8 Scripttype= "Text/javascript">9 $ (document). Ready (function(){Ten $("#btn1"). Click (function(){ One
disappears, the mouse removed keyword appears again, if you do not change after the input contentBody> onfocus is mouse click when onblur is left when mouse - inputID= "I1"type= "text"value= "Please enter keywords"onfocus= "Focus ();"onblur= "Blur ();" /> Scripttype= "Text/javascript"> functionFocus () {varTag=document.getElementById ('I1');//If you get the value of the input box as "Please enter a keyword", set the value to null
Using the JavaScript language, put the following array
var arr = ["', ' # # ',""," ","* "," # #"];
ARR[7] = "* *";
The pattern shown on the page is as follows:
Task decomposition
The first step: Define an array to store the graphics you want to show.
提示:var arr = [‘*‘,‘##‘,"***","","****","##*"]; arr[7"**";
Step Two: Imagine how long the arr array is?
提示: 使用alert弹出数组的长度,看看是否跟自己的答案一样。
The
make them easier to use.Function: 1. Simplify the interface of the class; 2. Eliminate the coupling between the class and the customer code that uses it.For example, the shortcut icons on the computer desktop are playing a role in the interface that directs the user to a place, and each operation is indirectly executed by some behind-the-scenes commands.Four expansion and in-depthThere are many design patterns in detail, please refer to Uncle Tom's in-depth understanding of the
In the daily work in the use of the native JS very little, feel that they have been the original JS forgotten, here to start summing up the next JS, from the basis of the beginning of it!!! The composition of javascript: 1, ECMAScript: Interpreter, translator. Personal understanding is the Analytic programming language. 2, Dom:document Object Model. Action page element 3, Bom:browser Object moder. Manipulate the data type of the browser
Reference Address: http://www.51xuediannao.com/jiqiao/webstorm.htmlWebstorm is a development tool for the JetBrains company, mainly for Web front-end development, softwareBootstrap is a front-end framework, the so-called framework is to meet the specific needs of the specific environment to provide some of the organic
First, Concept introductionCallBack: "Callback". In spring, excellent framework callbacks are ubiquitous, and callbacks are used in many scenarios, such as SWT event monitoring, Netty, and so on. Its main role is to improve the efficiency of the program execution, a piece of code does not have to wait until another piece of code execution end before continuing to run. In JavaScript is no exception.Second, J
dot.js--front-end JavaScript template engine Issue MemoI have a project in hand to meet a problem: The original project developers in JavaScript, a lot of stitching HTML, resulting in the code is extremely ugly, extremely difficult to maintain. How can they put up with such ugly, clumsy code, or perhaps they have a ver
event, bc = 123} 2. Bind Event *************** An event can only be bound once 3. Binding Events document.getElementById (' I1 '). AddEventListener (' click ', function () {Console.log (111);},true)document.getElementById (' I1 '). AddEventListener (' click ', function () {Console.log (222);},true) Ps:addeventlistener a third parameterDefault:Event bubblingCapture Type Owe:1. Likes + 1 animations 2. JavaScript Advanced knowledge-lexical analysis Ho
1. First look at W3school, understand what is JS, and then find a few books to write JS small effect of the book to see, Know what JS do;2. Then go through the API, recommend the "JavaScript authoritative guide", fourth edition, the sixth version of a lot of things do not need to be in contact with the time to understand, too deep;3. The end is "JavaScript design
negative.Write an example:var str= "Today is Tuesday";Console.log (Str.slice (3,6));//Intercept "Tuesday" and printConsole.log (str.substring (3,6));//Intercept "Tuesday" and printConsole.log (Str.substr (3,3));//Intercept "Tuesday" and printHowever, if only know to intercept the character "Tuesday" in Str, but it is difficult to count the "Tuesday" exactly where in Str, you can also use indexof () to obtain the location, as follows:var str= "Today is Tuesday";var i=str.indexof ("star");//Gets
To learn basic web Front-end development technologies, you must master: HTML, CSS, JavaScript language, and cssjavascript.
1.HTML is the carrier of webpage content. The content is the information that the Web Builder places on the page and allows users to browse, including text, images, and videos.
2.CSS style is a manifestation. It is like a webpage coat. For
Use JavaScript code to write out a function: Implement a large integer that pops up after passing in a two integer.
Task decomposition:The first step: Write code to complete the definition of a function.Step two: Let's add the control statement in the function body and complete the function function.提示:再想一想,两个整数比较有三种情况,大于,等于或小于,所以我们需要控制语句判断(if...elseif)。The third step: Write a good function, we can call the function arbitrarily. Implement two set
such as quotation marks, so will error, finally, I changed to the following this final version, OK:href="Javascript:click_me ({{! Json.stringify (Value)}}) ">{{=value.name}}a> So, if you want to pass an object, you need to convert the JSON object to a string and then encode it.So, solve my big problem, do not have to painstakingly stitching HTML, and in the process of using dot.js, there is no obstacle.Online about dot.js information is not much, if, the people see here, hope this text to you
the GetName function on its prototype as the constructor.The final result is 3.At lastAs far as the answer is concerned, the first 100% can be answered correctly, the second question is probably only 50% correct rate, the third question can answer the correct is not much, the fourth question again correct is very very few. In fact, this problem does not have too many tricky to use, are some of the scenarios may encounter, and most people have 1 to 2 years of work experience should be completely
Manipulating HTML elementsIf you want to access an HTML element from JavaScript, you can use the document.getElementById (ID) method.Use the ID property to identify the HTML element:Warning:Please use document.write () to write only to the document output.If document.write is executed after the document has finished loading, the entire HTML page will be overwritten:Program Demo:1 DOCTYPE HTML>2 HTML>3 Head>4 MetaCharSet= "Utf-8">5
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.