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

📄 默认商店内容页模板.html

📁 Enterprise Template for BizIdea 2.0, with full pictures and aspx files.
💻 HTML
📖 第 1 页 / 共 3 页
字号:

function getCookie(name)
{
   if (document.cookie.length > 0)
   {
      cookieStart = document.cookie.indexOf( name + "=" )
      if (cookieStart != - 1)
      {
         cookieStart = cookieStart + name.length + 1
         cookieEnd = document.cookie.indexOf( ";", cookieStart )
         if (cookieEnd == - 1) cookieEnd = document.cookie.length
         return unescape(document.cookie.substring( cookieStart, cookieEnd));
      }
   }
   return "";
}
</script>


<!-- 评论变量区 -->
<input id="username" type="hidden" value="游客" />
<input id="position" type="hidden" value="1" />
<input id="private" type="hidden" value="0" />
<input id="score" type="hidden" value="3" />
<input id="face" type="hidden" value="Images\Comment\01.gif" />
<input id="gid" type="hidden" value="@RequestInt_id" />
<input id="nid" type="hidden" value="{PE.Field id="cone" fieldname="NodeID" /}" />
<input id="tid" type="hidden" value="1" />
<!-- 评论变量区 -->
<script language="javascript" type="text/javascript">

var oID=0;
function ShowShopTabs(ID)
{
    if(oID != ID){
         document.getElementById("ShopTabTitle" + ID).className="Shop_mouseover";
         document.getElementById("ShopTab" + ID).style.display="";
         document.getElementById("ShopTabTitle" + oID).className="Shop_title";
         document.getElementById("ShopTab" + oID).style.display="none";
         oID = ID;
    }
}

/* 商品多属性与多图片展示开始 */
var propertyJson = {PE.Field id="cone" fieldname="PropertiesJson" /};//商品的多属性JSON对象
var propertyArr;                                                     //储存已选择的属性的数组
var propertyContainerId = "productInfo";                             //放置多属性选择器的ul容器ID
var productphotoId = "productphoto";                                 //展示商品图片的容器ID
var multiplePhotoId = "MultiplePhoto";                               //多图片展示区的容器ID
var stocks = {PE.Label id="获取多属性商品库存" productId="@RequestInt_Id" /};
var fieldJson = {PE.Field id="cone" fieldname="FieldJson" /};

//获取商品自定义字段表格
function GetFieldList()
{
    var container = document.getElementById("ShopTab2");    
    if(fieldJson.length == 0){
        container.innerHTML = "没有任何内容!";
    }else{
        var html="<table>";        
        for(var i=0;i<fieldJson.length;i++){
            html += "<tr>";
            html += "<td>"+fieldJson[i].alias+":</td>";
            html += "<td>"+fieldJson[i].value+"</td>"
            html += "</tr>"
        }
        html +="</table>";
        container.innerHTML = html;
    }    
}

function GetFieldValue(fieldname)
{
    for(var i=0;i<fieldJson.length;i++){
        if(fieldJson[i].name == fieldname){
            return fieldJson[i].value;
        }
    }
}

function GetFieldAlias(fieldname)
{
    for(var i=0;i<fieldJson.length;i++){
        if(fieldJson[i].name == fieldname){
            return fieldJson[i].alias;
        }
    }   
}

GetFieldList();


//创建多属性的选择提示
function CreateSelectInfo()
{
     var ul = document.getElementById(propertyContainerId);
     var li = document.createElement("li");
     li.setAttribute("id","PropertyInfo");
     var info = "请选择:";
     for(var i in propertyJson)
     {
        info += "“"+propertyJson[i].name+"”,"
     }
     info= info.substr(0,info.length -1);
     li.innerHTML =info;
     ul.appendChild(li);
}

//创建商品的多属性选择器
function CreateProperties()
{
    if(propertyJson.length > 0){
        propertyArr = new Array(propertyJson.length);
        CreateSelectInfo();
        var ul = document.getElementById(propertyContainerId);
        var limsg = document.createElement("li");
	    for(var i in propertyJson)
	    {
	    	var html="";
	        var li = document.createElement("li");
		    var property = propertyJson[i];
		    html += ("<ol class='ProductProperty'><li>"+property.name+":</li>") ;
		    if(property.type=="property"){
			    for(var p in property.values){
				    html += "<li title='"+property.values[p]+"' onclick='SelectProperty("+i+",\""+property.values[p]+"\",\"\")' ><a href='javascript:;'>&nbsp;"+property.values[p]+"&nbsp;</a></li>";
			    }
		    }
		    else if(property.type=="style"){		
			    for(var s in property.values){
				    var style = property.values[s];
				    html +="<li title='"+style.stylename+"' onclick='SelectProperty("+i+",\""+style.stylename+"\",\""+style.url+"\")'>";
				    html +="<a href='javascript:;' style='background:"+style.color+"'>";
				    if(style.url !=""){
					    html += "<img border='0' src='"+style.url+"' width='30px' height='32px' />"
						/*生成的缩略图属性设置*/
				    }
				    else if(style.color !=""){
					    html += "&nbsp;";
				    }
				    else{
					    html += "&nbsp;"+style.stylename+"&nbsp;";
				    }
				    html += "</a></li>";
			    }
		    }
		    html+="</ul><div class='clearbox'>";	
		    li.innerHTML = html;
		    ul.appendChild(li);
	    }
    }
}

CreateProperties();

function SetPhoto(photoUrl)
{
    if((photoUrl != undefined) && (photoUrl !="")){
		    document.getElementById(productphotoId).src=photoUrl;
	}
}

function SelectProperty(index,value,photoUrl)
{
    propertyArr[index] = value;
    var info = "";
    for(var i in propertyArr){
        if(propertyArr[i]!=""){
            info += "“"+propertyArr[i]+"”,";
        }
    }
    if(info != ""){
        document.getElementById("PropertyInfo").innerHTML ="您已选择:<span class='p_font_red'>"+ info.substr(0,info.length -1) + "</span>";
        
    }
    var s = stocks[propertyArr.join("|")];
    if(s != undefined){
        document.getElementById("productStocks").innerHTML = s.toString();
    }
    SetPhoto(photoUrl);
}

//获取已选择的属性组合
function GetProperties()
{
    if(propertyArr == undefined){
        return "";
    }
    var value = "";
    var hasAllSelect = true;
    var info="请选择:";
    for(var i=0;i<propertyArr.length;i++){
        if(propertyArr[i]==undefined || propertyArr[i]==""){
            info += "“"+propertyJson[i].name+"”,";
            hasAllSelect = false;
        }else{
            value += propertyArr[i]+"|";
        }
    }
    if(!hasAllSelect){
        alert(info.substr(0,info.length-1));
        return "";
    }else{
        return value.substr(0,value.length -1);
    }
}

//多图片展示
function GetMultiplePhoto()
{
    var PathList = '{PE.Field id="cone" fieldname="MultiplePhoto" /}';
    var pathArray = PathList.split('$$$');
    var html='';
    for(var i in pathArray){
        if(pathArray[i]!=""){
		    html +="<li><a href='javascript:;'><img onclick='SetPhoto(this.src)' border='0' src='{PE.SiteConfig.ApplicationPath/}{PE.SiteConfig.uploaddir/}/"+pathArray[i]+"' width='30px' height='32px' /></a></li>";
        }
    }
    document.getElementById(multiplePhotoId).innerHTML = html;
    
}
GetMultiplePhoto();
/* 商品多属性与多图片展示结束 */

function GetProductNum()
{
    var productNum = document.getElementById("txtNum");
    var numValue ='';
    if(productNum.value!='')
    {
        numValue = productNum.value;
    }
    return numValue;
}

function GotoShoppingCart()
{
   var url="{PE.SiteConfig.applicationpath/}Shop/ShoppingCart.aspx?Action=AddToCart&ID={PE.Field id="cone" fieldname="GeneralID" /}";
   var property = GetProperties();
   if(propertyJson.length > 0 && property == ""){
        return;
   }
   if(property!='')
   {
      url+="&Property="+ property;     
   }
   var proNum = GetProductNum();
   if(proNum!='')
   {
        url+="&Num="+proNum;
   }
    window.location.href=encodeURI(url);
}

function redirecturl(url, tarid)
{
    location=url.replace(/{\$pageid\/}/g,tarid);
}

//评论相关代码
function commentinit()
{
    var x = new AjaxRequest('XML','commentform');
    x.labelname = "内容评论PK标签";
    x.para = ['itemId=@RequestInt_id'];
    x.currentpage = 1;
    x.post('updatelabel', '{PE.SiteConfig.ajaxsitepath/}ajax.aspx', function(s) {
        var xml = x.createXmlDom(s);
        document.getElementById("commentform").innerHTML = xml.getElementsByTagName("body")[0].firstChild.data;
        changepage(1,'评论列表','JS_基本风格');
        getcurrentuserinfo()
    });
    
  
}

function SetPosition(st)
{
     for (i=-1;i<3;i++){
          if(i == st){
              document.getElementById("Positon" + i).className="PK_mouseover";

⌨️ 快捷键说明

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