JavaScript is a simple way to implement floating advertisements on Web pages. If you need it, you can refer to the Web roaming. You will find that the Internet is not only the ocean of information, but also the ocean of advertising. In addition to common Gif Banner and Flash, floating advertisements are also one of the most popular online advertisements. When you drag the browser's scroll bar, the advertisement floating on the page can move along with the screen. Although this effect is of great practical value for advertisement display, for those who browse your webpage, this is something that hinders reading and affects reading interests. Therefore, it must not be abused. However, if you can make good use of it, it can play a significant role.
It is not difficult to make a floating advertisement. If you have a JS foundation, you can write one by yourself. If you are too lazy to write one, download a special effect tool from the Internet, paste the code as prompted. However, to really understand how it is made, you need to master some JS knowledge. Here we will introduce a simple floating advertisement practice.
The following code can be found inAnd I added some comments (I .e., the text after "//" and" Text ).
The Code is as follows: