public 外贸多产品报价与HTML5 LocalStorage 本地存储实际案例

info

view_module外贸多产品报价与HTML5 LocalStorage 本地存储实际案例

多产品报价页面

引入多产品报价文件

<script type="text/javascript" src="includes/js/multiple_quoting.js"></script>


2016-05-21_111851.jpg



var MQlist=[];


if(typeof(Storage)==="undefined"){

alert('您的浏览器不支持localStorage特性,请更新您的浏览器!');

}


代码含义:打开多产品报价页面

function view_MQlist(){

var winMQ=window.open("multiple_quoting.php","winMQ");

}


代码含义:下面是载入本地数据

function clear_MQlist(){

MQlist=[];

localStorage["G_Multi_Quoting_List"]=JSON.stringify(MQlist);

}


function load_MQlist(){

  try{MQlist=JSON.parse(localStorage["G_Multi_Quoting_List"]);} 

  catch(e) {MQlist=[];}

}


function remove_MQlist(idx){

  MQlist.splice(idx,1);

  localStorage["G_Multi_Quoting_List"]=JSON.stringify(MQlist);

}




设置按钮-点击按钮运行2个程序

1add_to_MQlist(添加产品到本地)

2refresh_btnMQlist(隐藏显示点击按钮)


<div id="divMultiQuoting" style="display: block;">

<input type="button" value="Add to multi quote" onclick="this.style.display='none';add_to_MQlist(true);refresh_btnMQlist();" id="btnA2MQ" style="display: inline-block;">

<br><a id="aMQCount" target="winMQ" href="multiple_quoting.php">Multi Quote : 5</a></div>

2016-05-21_111936.jpg


add_to_MQlist

代码含义:添加一个当前页面的产品到多产品报价

function add_to_MQlist(bOpenWin){

var txt_project=document.getElementById('txt_project').value;

var txt_totqty=document.getElementById('txt_totqty').value;

var txt_exw_unit=document.getElementById('txt_exw_unit').value;

var txt_exw_total=document.getElementById('txt_exw_total').value;

var txt_tctn=document.getElementById('txt_tctn').value;

var txt_t_cbm=document.getElementById('txt_t_cbm').value;

var txt_ctn_Aweight=document.getElementById('txt_ctn_Aweight').value;

var txt_ctn_Mweight=document.getElementById('txt_ctn_Mweight').value;


var aTmp=[txt_project,txt_totqty,txt_exw_unit,txt_exw_total,

txt_tctn,txt_t_cbm,txt_ctn_Aweight,txt_ctn_Mweight];

MQlist.push(aTmp);

localStorage["G_Multi_Quoting_List"]=JSON.stringify(MQlist);

if (bOpenWin){view_MQlist();}

}


refresh_btnMQlist

假如本个产品被存了,则按钮被隐藏。

function refresh_btnMQlist(){

  document.getElementById('aMQCount').innerHTML='Multi Quote : '+MQlist.length;

  if (MQlist.length>0){

    document.getElementById('divMultiQuoting').style.display='block';

  } else {

    if (document.getElementById('btnA2MQ').style.display=='none'){

      document.getElementById('divMultiQuoting').style.display='none';

    }

  }

}  

refresh_btnMQlist();


申请在线申请ASI

参考价: $0

美国ASI协会方案
+¥5500
+¥4500
+¥40000
+¥1500
+¥4000

exit_to_app培训(60)
exit_to_app西联汇款(11)
exit_to_app外贸工具(15)
exit_to_app低成本创业(18)
exit_to_app关税(13)
exit_to_app产品风险(24)
exit_to_appPaypal(21)
exit_to_app邮件(13)
exit_to_app信用卡(7)
exit_to_appASI手册(27)
exit_to_app外贸SEO(9)
exit_to_appphotoshop技巧(6)
exit_to_app销售技巧(2)
exit_to_app供应商黑白名单(5)
exit_to_app海运费策略(26)
exit_to_app快递策略(38)
exit_to_appDDP(4)
exit_to_appDC(2)
exit_to_appGmail(13)
exit_to_app产品培训(4)
exit_to_app外贸询盘(5)
exit_to_appASI(87)
exit_to_app卖法研究(4)
exit_to_app关税(13)
exit_to_app业务员故事(4)
exit_to_app离岸公司(10)
exit_to_app包装(7)
exit_to_app谈判技巧(14)
exit_to_app验货(5)
exit_to_appsage(7)
exit_to_app看老外学英语(12)
exit_to_app开发客户渠道(5)
exit_to_appKMH提成系统(3)
exit_to_app品牌授权(2)
exit_to_app潘通色卡(4)
exit_to_app印刷(11)
exit_to_app矢量图(10)
exit_to_app收款(22)
exit_to_app程序代码(23)
exit_to_app美国ASI代理(21)