Please do not look at my source code, to see if the use of JS can be done
Example
Requirements:
1) page on the previous button;
2 After clicking the pop-up window, I was clicked;
The following figure:
The JavaScript code is as follows:
- Example 1
However, jquery is similar to this, but the HTML page does not need to fill in the onclick= "Myclick ()" Event Invoke Myclick () method, only to introduce the JQuery class library and its own jquery code.
Here is my jquery code implementation of the above diagram method
After reading the jquery example above, we can find that in fact we do not have to write in the HTML page, just introduce the relevant JS file can, so that the advantages can make our HTML page more simple, do not need to interspersed with complex JS code, so that the page and the perfect separation of the script, is not very magical?
Note: Examples of joined the charset= " GB2312 "is to enable it to display Chinese correctly because jquery is UTF-8 encoded.
students may ask what the "$" symbol in Demo1.js means. Kwooshung suggest that we don't underestimate it yo ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ because the core functions of jquery are implemented through this function, the jquery code written in the future is built on this function, simply put But why is it a function, obviously just a symbol ah?
in this case, I have abbreviated the code, their relationship is as follows, case-sensitive:
$ equivalent to jquery
$ (document). Ready () is equivalent to jquery (document). Ready ()
Their meaning in the example is equivalent to the JS
OnLoad () method
Click () indicates a mouse click event that will be explained in detail in the future
In this lesson, you only need to understand what the "$" symbol is OK, in the back of the study you will gradually become familiar with him ~
Well, isn't it interesting?
"Jobs"
1, in the page using CSS to define a long width is 100px div red area
2, the mouse clicks this red area, the pop-up dialog box, as to the dialog box what content casually.