function myeachtabledata(id)
{
var tabarr=new Array();
$('#'+id).find("tr").each(function(trindex)
{
tabarr[trindex]=new Array();
$(this).find("td").each(function(tdindex)
{
tabarr[trindex][tdindex]=$(this).text();
});
});
return window.location.href =("?a=export_csv &&str=" +tabarr);
}
{
var tabarr=new Array();
$('#'+id).find("tr").each(function(trindex)
{
tabarr[trindex]=new Array();
$(this).find("td").each(function(tdindex)
{
tabarr[trindex][tdindex]=$(this).text();
});
});
return window.location.href =("?a=export_csv &&str=" +tabarr);
}
+为运算符
a,b为操作数如果a或b是一个字符串,另一个操作数会被转换成string,在javascript权威指南中有明确的说明
a= "?a=export_csv &&str=";
b= tabarra+b="?a=export_csv &&str="+ tabarr.toString()
好同志,我不是城管,我是好人,给想想办法吧,js 我连2把刀都不算,硬头皮写,导出个csv人都说js自己就能干,我哪会啊,在后边用$.post传呢,数据回来了,可惜在firebug里面,咋弄出来啊。
Array.prototype.toString=function(){
return "["+this.join(",")+"]";
}
var arr=[];
arr[0]=[1,2];
arr[1]=['a','b'];
alert(arr);
<script type="text/javascript">
var arr=[1,2,3];
alert("this is :"+arr.toString() === "this is :"+arr);
</script>
这叫post?get好不好