ecshop后台新订单提示音播放的代码
2013-12-20 14:01:20;  来源:;  作者:;  评论:0 点击:

在admin templates 大部分htm主页的底部onload = function(){ 开始检查订单startCheckOrder();}同时在pagefooter htm中有{if $enable
在admin/templates/大部分htm主页的底部
onload = function()

{

// 开始检查订单

startCheckOrder();

}
同时在pagefooter.htm中有
{if $enable_order_check eq '0'}

startCheckOrder = function(){}

{/if}

保证了
当关闭订单提醒时不弹出相应的提示

startCheckOrder 的定义在admin/common.js中

/* *
* 开始检查新订单;
*/

function startCheckOrder()
{
checkOrder()
window.setInterval("checkOrder()", NEW_ORDER_INTERVAL);
}

/*
* 检查订单
*/

function checkOrder()
{
var lastCheckOrder = new Date(document.getCookie('ECS_LastCheckOrder'));
var today = new Date();

if (lastCheckOrder == null || today-lastCheckOrder >= NEW_ORDER_INTERVAL)
{
document.setCookie('ECS_LastCheckOrder', today.toGMTString());

try
{
Ajax.call('index.php?is_ajax=1&act=check_order','', checkOrderResp**e, 'GET', 'JSON');
}
catch (e) { }
}
}



/* *

* 处理检查订单的反馈信息

*/

function checkOrderResp**e(result)

{
//出错屏蔽
if (result.error != 0 || (result.new_orders == 0 && result.new_paid == 0))
{
return;
}

try
{
document.getElementById('spanNewOrder').innerHTML = result.new_orders;
document.getElementById('spanNewPaid').innerHTML = result.new_paid;
Message.show();
}

catch (e) { }

}
如上代码如果有订单就调用了

Message.show();

而Message:
/*

* 气泡式提示信息

*/

var Message = Object();
Message.bottom = 0;
Message.count = 0;
Message.elem = "popMsg";
Message.mvTimer = null;
Message.show = function()

{

try

{

Message.controlSound('msgBeep');

document.getElementById(Message.elem).style.visibility = "visible"

document.getElementById(Message.elem).style.display = "block"

Message.bottom = 0 - parseInt(document.getElementById(Message.elem).offsetHeight);

Message.mvTimer = window.setInterval("Message.move()", 10);

document.getElementById(Message.elem).style.bottom = Message.bottom + "px";

}

catch (e)
{
alert(e);
}

}



Message.move = function()

{

try

{

if (Message.bottom == 0)

{
window.clearInterval(Message.mvTimer)
Message.mvTimer = window.setInterval("Message.close()", 10000)
}


Message.bottom ++ ;

document.getElementById(Message.elem).style.bottom = Message.bottom + "px";

}
catch (e)
{
alert(e);
}
}


Message.close = function()

{

document.getElementById(Message.elem).style.visibility = 'hidden';

document.getElementById(Message.elem).style.display = 'none';

if (Message.mvTimer) window.clearInterval(Message.mvTimer)

}


Message.controlSound = function(_sndObj)

{

sndObj = document.getElementById(_sndObj);

try

{
sndObj.Play();
}
catch (e) { }
}
本文属转载文章,并不能保证完全正确,只供学习交流参考,版权归原作者所有。如果您认为有侵犯权利等不和法行为,请联系我们及时改正。http://www.zhuitaiyang.com/html/fcms/591.html

相关热词搜索:ecshop 后台 订单 提示音

上一篇:一种简单的phpcms v9网站迁移(换空间)方法
下一篇:无法定位WordPress内容目录(wp-content)解决办法

收藏
回到顶部