弹出迷你购物车

2016-07-07 14:55 来源:www.chinab4c.com 作者:ecshop专家

在网上找了几个版本,但在2.7.3下测试都不行,自己照葫芦画瓢改了一个版本,只改两个文件

1. 更改D:\AppServ\www\js的common.js
1)增加两个函数cancel_gwc和 open_gwc,

function cancel_gwc()
{
document.body.removeChild(docEle('speDiv'));

var i = 0;
var sel_obj = document.getElementsByTagName('select');
while (sel_obj[i])
{
sel_obj[i].style.visibility = "";
i++;
}
}


function open_gwc(cartinfo)
{
var _id = "speDiv";
var m = "mask";
if (docEle(_id)) document.removeChild(docEle(_id));
if (docEle(m)) document.removeChild(docEle(m));
//计算上卷元素值
var scrollPos;
if (typeof window.pageYOffset != 'undefined')
{
scrollPos = window.pageYOffset;
}
else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat')
{
scrollPos = document.documentElement.scrollTop;
}
else if (typeof document.body != 'undefined')
{
scrollPos = document.body.scrollTop;
}
var i = 0;
var sel_obj = document.getElementsByTagName('select');
while (sel_obj[i])
{
sel_obj[i].style.visibility = "hidden";
i++;
}


var newDiv = document.createElement("div");
newDiv.id = _id;
newDiv.style.position = "absolute";
newDiv.style.zIndex = "10000";
newDiv.style.width = "289px";
newDiv.style.height = "120px";
newDiv.style.top = (parseInt(scrollPos + 400)) + "px";
newDiv.style.left = (parseInt(document.body.offsetWidth) - 200) / 2 + "px";
newDiv.style.overflow = "hidden";
newDiv.style.background = "#FFF";
newDiv.style.border = "0px solid #59B0FF";
newDiv.style.padding = "0px";

newDiv.innerHTML = '<div style="text-align:center;height:120px;line-height:25px;width:289px;background:url(/data/images/div_bg.gif) no-repeat 0 0;overflow:hidden;"><table width="280px" cellpading=0 cellspacing=0 align=center ><th style="height:30px;line-height:30px;text-align:right;"><a href="javascript:cancel_gwc()" ><img src="/data/images/div_close.gif" style="margin:5px 10px;"></a></th><tr><td align=center ><img src="/data/images/div_hs.gif" align=absmiddle> <font style="font-size:15px;font-weight:bold;">该商品已成功放入购物车</font><br>'+cartinfo +'<br><a href="javascript:cancel_gwc()"><<继续购物</a> <ahref="flow.php"> <img src="/data/images/div_gwc.gif" align=absmiddle></a></td></tr>';
newDiv.innerHTML += '<tr><td align=center></td></tr></table></div>';
document.body.appendChild(newDiv);



2)更改addToCartResp**e末尾的switch,
switch(result.confirm_type)
{
case '1' :
/*if (confirm(result.message)) location.href = cart_url;*/
open_gwc(result.content)
break;
case '2' :
/*if (!confirm(result.message)) location.href = cart_url;*/
open_gwc(result.content)
break;
case '3' :
/*location.href = cart_url;*/
open_gwc(result.content)
break;
default :
break;
}

}

2.然后改一下D:\AppServ\www\languages\zh_cn的common.php
将$_LANG['cart_info'] = 'xxxxxxxx %d 件商品,xxxx %s';中引号内的字数减少

回答:



这个版本弹出的对话框位置不能自适应,在IE7 IE8下显示有点问题,影响美观。哪位知道缺货登记

对应的图层函数,看我想照着缺货登记对话框改一下

很不错 支持下

不知道能不能使用,溜达一圈 支持下

不错呢 支持

有没有演示地址或效果图看看。。。