?? 默認商店內容頁模板.html
字號:
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:;'> "+property.values[p]+" </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 += " ";
}
else{
html += " "+style.stylename+" ";
}
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]==""){
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 + -