This article shares the specific code for JS to realize the display of floating advertisements on the left and right for your reference. The specific content is as follows
<html> <title>Floating advertisements on both sides</title> <head> </head> <body> <table style="background-color:#EEEEE2;width:1024px;height:2000px;t" align="center"> <tr><td> </td></tr> </table> <SCRIPT LANGUAGE="JavaScript"> <!-- var showad = true; var Toppx = 60; //Upper position var AdDivW = 100; //width var AdDivH = 300; //high var PageWidth = 800; //The left and right scroll bars appear under the pixels of the page width var MinScreenW = 1024; // Display the minimum screen width pixel of the ad var ClosebuttonHtml = '<div align="right" style="position: absolute;top:0px;right:0px;margin:2px;padding:2px;z-index:2000;"><a href="javascript:;" rel="external nofollow" rel="external nofollow" mce_href="javascript:;" rel="external nofollow" rel="external nofollow" onclick="hidead()" style="color:red;text-decoration:none;font-size:12px;" mce_style="color:red;text-decoration:none;font-size:12px;">closure</a></div>' var AdContentHtml = '<div align="center" style="color:green;font-size:23pt;font-family:bold;" mce_style="color:green;font-size:23pt;font-family:bold;"><br><br>advertise</div>'; document .write('<div id="" style="position: absolute;border: 1px solid #336699;background-color:#EEEEE2;z-index:1000;width:'+AdDivW+'px;height:'+AdDivH+'px;top:-1000px;word-break:break-all;display:none;">' + ClosebuttonHtml + '<div>' + AdContentHtml + '</div></div>'); document .write('<div id="" style="position: absolute;border: 1px solid #336699;background-color:#EEEEE2;z-index:1000;width:'+AdDivW+'px;height:'+AdDivH+'px;top:-1000px;word-break:break-all;display:none;">' + ClosebuttonHtml + '<div>' + AdContentHtml + '</div></div>'); function scall() { if (!showad) { return; } if ( < MinScreenW) { //alert("Temporary prompt: /n/n monitor resolution width is less than " + MinScreenW + ", no advertisements are displayed"); showad = false; (""). = "none"; (""). = "none"; return; } var Borderpx =( (( - PageWidth) / 2 - AdDivW) / 2 ); (""). = ""; (""). = + Toppx; (""). = + Borderpx; (""). = ""; (""). = + Toppx; (""). = + - ("").offsetWidth - Borderpx; } function hidead() { showad = false; (""). = "none"; (""). = "none"; } = scall; = scall; = scall; //--> </SCRIPT> </body> </html>
The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.