⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 template_dropdown.js

📁 商城改进板全站代码
💻 JS
字号:

function ObjectAD() {
  /* Define Variables*/
  this.ADID        = 0;
  this.ADType      = 0;
  this.ADName      = "";
  this.ImgUrl      = "";
  this.ImgWidth    = 0;
  this.ImgHeight   = 0;
  this.ShowTime    = 0;
  this.LinkUrl     = "";
  this.LinkTarget  = 0;
  this.LinkAlt     = "";
  this.Priority    = 0;
  this.CountView   = 0;
  this.CountClick  = 0;
  this.InstallDir  = "";
  this.ADDIR       = "";
  this.ADIntro     = "";
  this.EndTime     = ""
}

function DropDownZoneAD(_id) {
  /* Define Constants */
  this.adNum       = 0;
  this.adDelay     = 6000;

  /* Define Common Variables*/
  this.ID          = _id;
  this.ZoneID      = 0;
  this.ZoneName    = "";
  this.ZoneWidth   = 0;
  this.ZoneHeight  = 0;
  this.ShowType    = 1;
  this.DivName     = "";
  this.Div         = null;
  this.ShowTime    = 7000;
  this.zoneActive  = "False";
  

  /* Define Unique Variables*/
  this.CookieHour  = 0;
  /* Define Objects */
  this.AllAD       = new Array();
  this.ShowAD      = null;

  /* Define Functions */
  this.AddAD       = DropDownZoneAD_AddAD;
  this.GetShowAD   = DropDownZoneAD_GetShowAD;
  this.Show        = DropDownZoneAD_Show;
  this.LoopShow    = DropDownZoneAD_LoopShow;
  this.CookieCheck = DropDownZoneAD_CookieCheck;


}

function DropDownZoneAD_AddAD(_AD) {
  if(this.zoneActive!="True"){
      return ;
  }
  var strDate=_AD.EndTime;
  var splitArray=strDate.split("-"); 
  var enddate=  new Date(splitArray[0],splitArray[1]-1,splitArray[2]); 
  var datenow=new Date();
  if(datenow>enddate)
  {
    document.writeln("该广告已经过期!");
    return  ;
  }  
  this.AllAD[this.AllAD.length] = _AD;
}

function DropDownZoneAD_GetShowAD() {
  if (this.ShowType > 1) {
    this.ShowAD = this.AllAD[0];
    for (var i = 0; i < this.AllAD.length; i++) {
        if(this.AllAD[i].Priority > this.ShowAD.Priority){
            this.ShowAD = this.AllAD[i];
        }
    }
    return;
  }
  var num = this.AllAD.length;
  var sum = 0;
  for (var i = 0; i < num; i++) {
    sum = sum + this.AllAD[i].Priority;
  }
  if (sum <= 0) {
    if(num >= 1){
      this.ShowAD = this.AllAD[0];
    }
    return ;
  }
  var rndNum = Math.random() * sum;
  i = 0;
  j = 0;
  while (true) {
    j = j + this.AllAD[i].Priority;
    if (j >= rndNum) {break;}
    i++;
  }
  this.ShowAD = this.AllAD[i];
}

function DropDownZoneAD_Show() {
  if (!this.AllAD) {
    return;
  } else {
    this.GetShowAD();
  }

  if (this.ShowAD == null) return false;
  if (this.CookieCheck()) return false;
  this.DivName = "DropDownZoneAD_Div" + this.ZoneID;
  dropDownID=this.DivName;
  if (!this.ShowAD.ImgWidth) this.ShowAD.ImgWidth = this.ZoneWidth
  if (!this.ShowAD.ImgHeight) this.ShowAD.ImgHeight = this.ZoneHeight
  if (this.ShowAD.ADDIR=="") this.ShowAD.ADDIR = "IMS_AD";
  
  document.write("<div id='" + this.DivName + "' style='display:none;visibility:visible; z-index:1; overflow:hidden;width:" + this.ZoneWidth + "px; height:" + this.ZoneHeight + "px;' >"+AD_Content(this.ShowAD) + "</div>");
 
  this.Div = document.getElementById(this.DivName);
  DropDownZoneAD_showfull(this.DivName,this.ShowTime);
  //if (this.ShowType == 3) this.LoopShow();
}

function DropDownZoneAD_LoopShow() {
  if(this.adNum<this.AllAD.length-1) this.adNum++ ; 
  else this.adNum=0; 
  this.Div.filters.revealTrans.Transition=Math.floor(Math.random()*23); 
  this.Div.filters.revealTrans.apply(); 
  if (this.AllAD[this.adNum].ImgWidth) this.AllAD[this.adNum].ImgWidth = this.ZoneWidth
  if (this.AllAD[this.adNum].ImgHeight) this.AllAD[this.adNum].ImgHeight = this.ZoneHeight
  this.Div.innerHTML=AD_Content(this.AllAD[this.adNum]);
  this.Div.filters.revealTrans.play() 
  this.Div.timer=setTimeout(this.ID+".LoopShow()",this.adDelay);
}

function AD_Content(o) { 
  var str = "";
  if (o.ADType == 1 || o.ADType == 2) {
  /*   o.ImgUrl = o.ImgUrl.toLowerCase()
   if (o.InstallDir.indexOf("http://") != - 1) o.ImgUrl = o.InstallDir.substr(0, o.InstallDir.length - 1) + o.ImgUrl;*/
    if (o.ImgUrl.indexOf(".swf") !=  - 1) {
      str = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0'";
      str += " name='AD_" + o.ADID + "' id='AD_" + o.ADID + "'";
      str += " width='" + o.ImgWidth + "'";
      str += " height='" + o.ImgHeight + "'";
      if (o.style) str += " style='" + o.style + "'";
      if (o.extfunc) str += " " + o.extfunc + " ";
      str += ">";
      str += "<param name='movie' value='" + o.ImgUrl + "'>";
      if (o.FlashWmode == 1) str += "<param name='wmode' value='Transparent'>";
      if (o.play) str += "<param name='play' value='" + o.play + "'>";
      if (typeof(o.loop) != "undefined") str += "<param name='loop' value='" + o.loop + "'>";
      str += "<param name='quality' value='autohigh'>";
      str += "<embed ";
      str += " name='AD_" + o.ADID + "' id='AD_" + o.ADID + "'";
      str += " width='" + o.ImgWidth + "'";
      str += " height='" + o.ImgHeight + "'";
      if (o.style) str += " style='" + o.style + "'";
      if (o.extfunc) str += " " + o.extfunc + " ";
      str += " src='" + o.ImgUrl + "'";
      if (o.FlashWmode == 1) str += " wmode='Transparent'";
      if (o.play) str += " play='" + o.play + "'";
      if (typeof(o.loop) != "undefined") str += " loop='" + o.loop + "'";
      str += " quality='autohigh'"
      str += " pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash'></embed>";
      str += "</object>";
    } else if (o.ImgUrl.indexOf(".gif") !=  - 1 || o.ImgUrl.indexOf(".jpg") !=  - 1 || o.ImgUrl.indexOf(".jpeg") !=  - 1 || o.ImgUrl.indexOf(".bmp") !=  - 1 || o.ImgUrl.indexOf(".png") !=  - 1) {
      if (o.LinkUrl) {
        if (o.CountClick) o.LinkUrl = o.InstallDir + o.ADDIR + "/Admin_ADCount.aspx?Action=Click&ADID=" + o.ADID
        str += "<a href='" + o.LinkUrl + "' target='" + ((o.LinkTarget == 0) ? "_self" : "_blank") + "' title='" + o.LinkAlt + "'>";
      }
      str += "<img ";
      str += " name='AD_" + o.ADID + "' id='AD_" + o.ADID + "'";
      if (o.style) str += " style='" + o.style + "'";
      if (o.extfunc) str += " " + o.extfunc + " ";
      str += " src='" + o.ImgUrl + "'";
      if (o.ImgWidth) str += " width='" + o.ImgWidth + "'";
      if (o.ImgHeight) str += " height='" + o.ImgHeight + "'";
      str += " border='0'>";
      if (o.LinkUrl) str += "</a>";
    }
  } else if (o.ADType == 3 || o.ADType == 4) {
    str = o.ADIntro
  } else if (o.ADType == 5) {
    str = "<iframe id='" + "AD_" + o.ADID + "' marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no width=100% height=100% src='" + o.ADIntro + "'>wait</iframe>";
  }
  return str;
}

function DropDownZoneAD_changediv(dropDownID,showTimes)
{    
	document.getElementById(dropDownID).style.display = "block";
	setTimeout(_DropDownZoneAD_hidediv(dropDownID) ,showTimes)
}
function DropDownZoneAD_hidediv(dropDownID)
{
	document.getElementById(dropDownID).style.display="none";
	
}
function DropDownZoneAD_showfull(dropDownID,showTime)
{   
   setTimeout(_DropDownZoneAD_changediv(dropDownID,showTime),2000); 
}

function _DropDownZoneAD_showfull(dropDownID,showTime)
{
   return function(){
     DropDownZoneAD_showfull(dropDownID,showTime)
  }   
}

function _DropDownZoneAD_hidediv(dropDownID)
{
    return function(){
     DropDownZoneAD_hidediv(dropDownID);
  }  
	
	
}
function _DropDownZoneAD_changediv(dropDownID,showTimes)
{
     return function(){
       DropDownZoneAD_changediv(dropDownID,showTimes)
  } 
}

function DropDownZoneAD_CookieCheck() {
  if (!this.CookieHour) return false;
  var Now = new Date();
  var strToday = String(Now.getYear()) + String(Now.getMonth() + 1) + String(Now.getDate());
  var ADCookie = "AD_Cookie_" + this.ZoneID
  if (GetCookie(ADCookie) == strToday)
    return true;
  else {
    Now.setTime(Now.getTime() + (parseFloat(typeof(this.CookieHour) == "undefined" ? 24 : parseFloat(this.CookieHour)) * 60 * 60 * 1000));
    AD_SetCookie(ADCookie, strToday, Now);
    return false;
  }
}

function GetCookie(name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return GetCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
  }
  return null;
}

function GetCookieVal(offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function AD_SetCookie(name, value)
{
    var argv = AD_SetCookie.arguments;
    var argc = AD_SetCookie.arguments.length;
    var expires = (argc > 2) ? argv[2]: null;
    var path = (argc > 3) ? argv[3]: null;
    var domain = (argc > 4) ? argv[4]: null;
    var secure = (argc > 5) ? argv[5]: false;
    document.cookie = name + "=" + escape(value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : "");
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -