(Original) [Penian Advertising] JS Script

xiaoxiao2021-03-06  41

I haven't been updated for a long time. During this time, I am busy with the .NET platform .. ISP has no contact .... Today, I will update my blog .. Today is the last day of 2004. When it is a gift Bar

Today, I need to put a pair of advertisements because of a page. So I created an idea of ​​a script class (old habits, I always wanted to pack something in the class. Oh) still not saying anything. To see something is in the code ( Note also added a lot) sample code also sent ...

// ******************************************************** & **************************************** // author: fish wah // & Date: December 31, 2004 // & Website: http://www.13smile.com////////////////////////////////////////////////brus: [Penian Advertising] JS script Class // & effect: Display Page Advertise // & method: // & smileadver.setleftpos (10); // Set the position (PX) // & smileadver.Setlefttop (150) on the left side of the page on the left. / / Set the position (PX) // & smileadver.setrightpos // & smileadver.seRightpos // & smileadver.setrightpos (10) on the left side; // set the position (PX) // & smileadver.seRighttop // & smileadver.seRighttop (150); // Set the location (PX) // & smileadver.addleftImage (link, image address, link target, picture prompt) on the right parallel pages; // add the picture // & smileadver.addrightImage (link, image address) , Link target, picture prompts); // Add picture // & smileadver.scroll (); // display coupled advertisement // & // ************** *********************************************************** ********************************* Function Smileadver_Class () {var LeftImageArray = New Array (); // Save the left advertisement image array var RightImageArray = New Array ( ); / / Save the right of the advertisement image VAR LEFTPOS, RIGHTPOS; // Leftpos = Left advertisement position (PX) Rightpos = Right Bar position (PX) VAR Lefttop, Righttop; // lefttop = Top Bench of the left advertisement (PX) Righttop = Top Bench Position (PX) Var lastscrolly = 0 in the right ad (PX) VAR lastscrolly = 0; // Default 10 lefttop = RightTop = 150; // Default 150 this.setleftpos = function (value) {if (isnan (value)) {value = 10;} // Number, default is 10 leftpos = value;} this.setrightpos = function (value) {ified (Value)) {value = 10;} // Non number, default is 10 Rightpos = value;} this.setlefttop = function (value) {if (isnan (value) {value = 150;} // Number Default 150 lefttop = value;} this.setrighttop = function (value) {if (isnan (value)) {value = 150;} // Number, default is 150 Righttop = Value;

} // Add Image Advertising AddingImage (Link, Image Address, Link Target, Photo Tips) this.addleftImage = Function (HREF, Image, Target, Title) {var imageArray = GetImageArray (href, image, target, title) if (imageArray = null!) {leftImageArray [leftImageArray.length] = imageArray;}} // add image ads addRightImage the right (links, images address, link targets, suggesting the picture) this.addRightImage = function (href, image, target {Var ImageArray = GetImageArray (href, image, target, title); if (imageArray! = null) {RightImageArray [RightImageArray.Length] = ImageArray;}} // Internal Add Advertising image, if there is no image address, Then return a null value, otherwise returns an array Function GetImageArray (href, image, target, title) {if (image == undefined) {return null;} // no image address, do not add if (target == undefined || Target == "" "{target =" _blank "}; // defaults to _blank open mode target =" target = / "" target "/" "; if (title == undefined) {// Advertising picture Title Tips Title = "";} else {title = "Title = /" Title "/" ";} // Link in www .The automatically adds http: // (otherwise link error) IF (href.tolowercase (). Substring (0, 4) == "WWW.") {href = "HT TP: // " href;} if (image.tolowercase (). Substring (0,4) ==" www. ") {image =" http: // " image;} return new array (href, image , TARGET, TITLE (} // Internal display picture banner showing showimagediv (Name of DIV) Function Showimagediv (Div, POS, POSPX, TOPPX, ImageArray) {var i; document.write ("

> "); For (i = 0; i "); if (i! = imageArray.length-1) {document.write ("

< Tr>
");}} Document.write (" ");} // Scroll Ad Tones THIS.SCROLL = FUNCTION ) {showImageDiv ( "smilediv1", "left", leftPos, leftTop, leftImageArray); showImageDiv ( "smilediv2", "right", rightPos, rightTop, rightImageArray); window.setInterval (scrollImage, 1);} // internal Used to scroll the advertisement picture function scrollimage () {var Diffe, percent; diff = document.body.scrolltop; percent = .1 * (degfy-lastscrolly); if (percent> 0) percent = math.ceil (percent); else percent = Math.floor (percent); document.all.smilediv1.style.pixelTop = percent; document.all.smilediv2.style.pixelTop = percent;}} /// using the type end / class; lastScrollY = lastScrollY percent Sample code VAR smileadver = new SmileAdver_Class (); SmileAdver.setLeftPos (10); SmileAdver.setRightPos (10); SmileAdver.setLeftTop (150); SmileAdver.setRightTop (150); SmileAdver.addLeftImage ( "http://www.138tips.com/", " http://www.88ball.com/images/138tips.gif""""ASDFASDF");smileadver.addleftImage("http://www.138tips.com/", "http://www.88ball .com / images / 138TIPs.gif "); SmileAdver.AddleftImage ("

转载请注明原文地址:https://www.9cbs.com/read-74393.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.039, SQL: 9