Let's talk about the basic knowledge of functions in JavaScript. Today, we will begin lecture 4th in the MooTools series. If you have not read the previous lecture, first check the previous tutorial "Mootools 1.2 tutorial (3) -- Introduction to array usage". Today, we will not talk about MooTools, but about the basic knowledge of functions in JavaScript.
However, to comply with the MooTools topic, you need to know where to use the functions of MooTools. Previously, we put the code in the domready method in all our sample code. When we need to put it out of domready, we use a function ). Before you call a function in domready, the function will not be executed.
In general, a better way is to place your function code somewhere outside the page as much as possible, and then call them through JavaScript applications. When you just write code for fun, it is easier to write everything on a single page. In this tutorial, we use the following conventions:
The Code is as follows: