Home >Web Front-end >JS Tutorial >What effects can javascript achieve?
Javascript can implement carousel images, form validation, pop-up boxes in the page, multi-level tabs, animations on the web page, floating advertisements, shaking pictures, five-pointed stars to achieve ratings, and the page can be displayed at a certain time If no event occurs within the period, the effect will be closed.
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
Since it is a technology that must be learned in front-end development, then it must be very useful, right? Yes, there are so many things that js can do. Because js can easily manipulate the DOM, it can present various effects on the client. So what effects are achieved by js? Here are some common effects for novices to refer to, so that new students can have an idea of what js does. As long as you learn how to use the JavaScript language, you can easily create the following effects.
1. Carousel image: Carousel image is usually a place to switch images in the middle of the website, as shown in the figure below.
The effect of sliding pictures one by one. Its principle is actually very simple: the box displaying the picture in the middle can only accommodate the display of one picture. In fact, there is a height inside this box that is as high as the display box, but the width is much larger than the display box. This long large box contains There are several pictures placed side by side from left to right. These pictures are used for carousel. When displaying, you only need to change the exposed position of this long box. As shown below.
So how to achieve this effect through js: After the css layout is done to create such a small box nested in a large box, the effect of leaking a picture can be achieved by using css positioning technology , all js has to do is to dynamically change the positioning value.
2. Form verification: The form is the part you need to fill in when registering and logging in to your account. It is called a form. For example, when registering, if the password entered twice is inconsistent, a red prompt message will appear immediately. This is the effect created by js.
#3. Pop-up boxes on the page: For example, the warnings and prompt messages that pop up on the page are all made by js.
4. Multi-level tabs: Like Taobao's product categories, a category will appear when the mouse is placed on it, and a category can be divided from this category. These are also done by js.
There are many effects that js can do, such as animations on web pages, floating advertisements, shaking pictures, five-pointed stars to achieve scoring effects, the page will be closed if no event occurs within a certain period of time, etc. Here are Not listed one by one. If you learn js, you can easily create these effects.
[Recommended learning: javascript advanced tutorial]
The above is the detailed content of What effects can javascript achieve?. For more information, please follow other related articles on the PHP Chinese website!