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

📄 index.js

📁 商城改进板全站代码
💻 JS
字号:
// JScript 文件

var pushName=new Array();
var pushSrc=new Array();
var pushLink=new Array();
var pushShow="";
var rollId;
var shop_instalDir="/"; //网站安装根目录,若放在根目录下直接填写"/"  
var mainPushNum;
function $(id)
{
  return document.getElementById(id);
} 
function ShowIndexSildAd()
{             
//     var IndexPicWindowObj=document.getElementById("IndexPicWindow");

//     for(var i=0;i<IndexPicWindowObj.childNodes.length;i++)
//     {
//          if(IndexPicWindowObj.childNodes[i].hasChildNodes())
//          {                   
//            pushLink.push(IndexPicWindowObj.childNodes[i].getAttribute("href"));
//            pushSrc.push(IndexPicWindowObj.childNodes[i].childNodes[0].getAttribute("src"));
//            pushName.push(IndexPicWindowObj.childNodes[i].childNodes[1].nodeValue);
//          }
//     }             
     if(window.IndexFlash)
     {
        for(var i=0;i<IndexFlash.length-1;i++)
        {
            pushLink.push(IndexFlash[i][2]);
            pushSrc.push(IndexFlash[i][1]);
            pushName.push(IndexFlash[i][0]);
           
           
        }
     }  
    //初始化
    for(i=0;i<5;i++){
        pushShow+='<a href="'+pushLink[i]+'" onmouseover="showPushLink('+i+');clearInterval(rollId)" id="linkPush'+i+'" target="_blank">'+pushName[i]+'</a>';
    }
    document.getElementById("linkPush").innerHTML=pushShow;
    mainPushNum=rand(5);
    document.getElementById("linkPush"+mainPushNum).className="linkPushHere";
    document.getElementById("mainPush").innerHTML='<a href="'+pushLink[mainPushNum]+'" target="_blank" id="pushImgLink" onmouseover="clearInterval(rollId)" onmouseout="showAtTime()"><img src="'+pushSrc[mainPushNum]+'" name="pushImg" width="293" height="280" id="pushImg" alt="'+pushName[mainPushNum]+'" /></a>';
    rollId=setInterval("showPushLink()",5000);
} 

function nextSale(order){
	if(order=="up")	saleNum++;
	else saleNum--;
	if(saleNum>2)	saleNum=0
	else if(saleNum<0) saleNum=2;
	for(i=0;i<2;i++)
		document.getElementById("saleList"+i).style.display="none";
	document.getElementById("saleList"+saleNum).style.display="";
}
function showLink(name,order){
	for(i=0;i<2;i++){
		document.getElementById(name+"Push"+i).style.display="none";
		document.getElementById(name+"Link"+i).className=""
	}
	document.getElementById(name+"Push"+order).style.display="";
	document.getElementById(name+"Link"+order).className=name+"LinkHere";
}
function showPushLink(num){
	if(!num&&num!=0){
		mainPushNum++;
		if(mainPushNum>4) mainPushNum=0;
		num=mainPushNum;
	}
	for(i=0;i<5;i++){
		document.getElementById("linkPush"+i).className="";
	}
	document.getElementById("linkPush"+num).className="linkPushHere";
	document.getElementById("pushImg").src=pushSrc[num];
	document.getElementById("pushImgLink").href=pushLink[num];
	document.getElementById("pushImg").alt=pushName[num];
}
function showAtTime(){
	showPushLink();
	rollId=setInterval("showPushLink()",5000);
}
 function cleanWhiteSpace(element){
     for(var i=0;i<element.childNodes.lenght;i++){
        var node=element.childNodes[i];
        if(node.nodeType==3&&!/\S/.test(node.nodeValue))
        node.parentNode.removeChild(node);
     }
  
}
rnd.today=new Date(); 
rnd.seed=rnd.today.getTime(); 
function rnd(){ 
   rnd.seed = (rnd.seed*9301+49297) % 233280; 
  return rnd.seed/(233280.0); 
}

function rand(number){ 
   return Math.ceil(rnd()*number)-1; 
}  


function CheckLoginStatus() 
{  
    var LoginUserName=getCookie("Howave_UnicodeUserName");
    var LoginPassword=getCookie("Howave_UserPassword");   
    
    
    if(LoginUserName!="" && LoginUserName!=null && LoginPassword!=null && LoginPassword!="")
    {  
     
       function callbackHandler(rValue) {      
            var result = rValue.responseText;        
            if(result=="0")
            {
               ShowLogin();
            }
            else if(result=="1")
            {
               ShowTopLoginSuccess(LoginUserName);              
              
            }       
        }
        function onErrorHandler()
        {
          return "Server Unvaliable";
        } 
        var url=shop_instalDir+"Shop/WebService/ShopService.ashx?Action=CheckLogin&UserName="+LoginUserName+"&Password="+LoginPassword+"&Rnd="+Math.random();
        var _ajax_=new HttpAjax();    
	    _xmlReq_ = _ajax_.synchronCreate(url,callbackHandler,onErrorHandler); 
	    
	    
           
               
    }
    else
    {      
       ShowLogin();
    }
    
   
   

}  
function getCookie(cookieName)
{
    var cookieString = document.cookie
    var first ,last
    first=cookieString.indexOf(cookieName)
    if(first!=-1)
    {
       first+=(cookieName.length+1)
       last=cookieString.indexOf(';',first)
       
       return unescape(cookieString.substring(first,last));
    }
    return null;
    
} 

function GetUnReadMessage()
{
    var LoginUserName=getCookie("Howave_UnicodeUserName");
    var LoginPassword=getCookie("Howave_UserPassword");   
    var MsgObj=document.getElementById("UnReadMsgCount");
    
    if(LoginUserName!="" && LoginUserName!=null && LoginPassword!=null && LoginPassword!="" && MsgObj!=null)
    {  
     
         var UserName=escape(LoginUserName);
         var _ajax_=new HttpAjax();   
	     _xmlReq_ = _ajax_.updateContent(shop_instalDir+"Shop/WebService/ShopService.ashx?Action=GetUnReadMsg&UserName="+UserName+"&Rnd="+Math.random(),"UnReadMsgCount");
	     setTimeout("GetUnReadMessage()",60000);  //60秒更新一次顶部 
               
    }
    
     
}
function ShowTopLoginSuccess()
{
  var UserName=getCookie("Howave_UnicodeUserName");
 
  document.writeln("<font color='#000'>您好,欢迎&nbsp;</font><span style='color:red'>"+UserName+"</span>!&nbsp;&nbsp;");  
  document.writeln( " <img src=\""+shop_instalDir+"shop/images/laba.gif\"  align='absmiddle' id='MsgIcon' title='站内短信'/>");
  document.writeln(" <a id='TopSiteMessage' href='"+shop_instalDir+"Shop/Member/Shop_Index.aspx?mainurl=Shop_Message.aspx' target='_blank'><span id='UnReadMsgCount'></span></a>&nbsp;");  
  document.writeln( " | [ <a href='"+shop_instalDir+"Passport/Logout.aspx'>退出</a> ]"); 
  GetUnReadMessage() ;
  
  
}



function ShowLogin()
{
  var UserName=getCookie("Howave_UnicodeUserName");
  
  document.writeln("<font color='#000'>您好,&nbsp;</font>");
  if(UserName !=""&& UserName !=null)
  {
     document.writeln("<span style='color:red'>"+UserName+"!</span>");
  }
  else if(window._siteName)
  {
     document.writeln("欢迎来到"+_siteName+"!");
  }
  document.writeln(" [ <a href='"+shop_instalDir+"Passport/Login.aspx'>登录</a> ] |");
  document.writeln(" [ <a href='"+shop_instalDir+"Passport/UserReg.aspx'>注册</a> ] ");
  
  
}  

⌨️ 快捷键说明

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