ie8 能正常出来,火狐出不来 js

一切为了你 2011-06-28 09:44:21
<script type="text/javascript">
function table3(total,table_x,table_y,all_width,all_height,table_type)
{
//参数含义(传递的数组,横坐标,纵坐标,图表的宽度,图表的高度,图表的类型)
var tmdColor1 = new Array();
var t = "";
var allColor = "";
for(var i=0;i<total[0].length;i++)
{
do
{
t = "#"+ Math.floor(Math.random()*Math.pow(2,24)).toString(16);
}while(allColor.indexOf(t)>-1);
tmdColor1[i] = t;
allColor += t+",";
t = "";
}

var tmdColor2 = new Array();

for(var i=0;i<total[0].length;i++)
{
do
{
t = "#"+ Math.floor(Math.random()*Math.pow(2,24)).toString(16);
}while(allColor.indexOf(t)>-1);
tmdColor2[i] = t;
allColor += t+",";
t = "";
}

var tb_color = new Array(tmdColor1,tmdColor2);
var tb_height = 30;
var total_no = total[0].length;
var totalpie = 0;
for(var i=0;i<total_no;i++)
{
totalpie += total[1][i];
}
var PreAngle = 0;
for(var i=0;i<total_no;i++)
{
document.write("<v:shape id='_x0000_s1025' alt='' style='position:absolute;left:" + table_x + "px;top:" + table_y + "px;width:" + all_width + "px;height:" + all_height + "px;z-index:1' coordsize='1500,1400' o:spt='100' adj='0,,0' path='m750,700ae750,700,750,700," + parseInt(23592960*PreAngle) + "," + parseInt(23592960*total[1][i]/totalpie) + "xe' fillcolor='" + tb_color[0][i] + "' strokecolor='#FFFFFF'><v:fill color2='" + tb_color[1][i] + "' rotate='t' focus='100%' type='gradient'/><v:stroke joinstyle='round'/><v:formulas/><v:path o:connecttype='segments'/></v:shape>");
PreAngle += total[1][i] / totalpie;
}

if(table_type=="A")
{
document.write("<v:rect id='_x0000_s1025' style='position:absolute;left:" + (table_x + all_width + 20) + "px;top:" + (table_y + 20) + "px;width:100px;height:" + (total_no * tb_height + 20) + "px;z-index:1'/>");
for(var i=0;i<total_no;i++)
{
document.write("<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:" + (table_x + all_width + 25) + "px;top:" + (table_y+30+(i)*tb_height) + "px;width:60px;height:" + tb_height + "px;z-index:1'>");
document.write("<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='left'>" + total[0][i] + "</td></tr></table></v:textbox></v:shape>");
document.write("<v:rect id='_x0000_s1040' alt='' style='position:absolute;left:" + (table_x + all_width + 80) + "px;top:" + (table_y + 30 + (i)*tb_height+3) + "px;width:30px;height:20px;z-index:1' fillcolor='" + tb_color[0][i] + "'><v:fill color2='" + tb_color[1][i] + "' rotate='t' focus='100%' type='gradient'/></v:rect>");
//显示比例数
document.write("<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:" + (table_x+all_width+110) + "px;top:" + (table_y+30+(i)*tb_height) + "px;width:60px;height:" + tb_height + "px;z-index:1'>");
document.write("<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='left'>" + Math.round(parseFloat(total[1][i]*100/totalpie)*100)/100 + "%</td></tr></table></v:textbox></v:shape>");
}
}

if(table_type == "B")
{
var pie = 3.14159265358979;
var TempPie = 0;
for(var i=0;i<total_no;i++)
{
var TempAngle = pie * 2 * (total[1][i] / (totalpie * 2) + TempPie);
var x1 = table_x + all_width/2 + Math.cos(TempAngle) * all_width * 3/8;
var y1 = table_y + all_height/2 - Math.sin(TempAngle) * all_height * 3/8;
var x2 = table_x + all_width/2 + Math.cos(TempAngle) * all_width * 3/4;
var y2 = table_y + all_height/2 - Math.sin(TempAngle) * all_height * 3/4;

if(x2>table_x + all_width/2)
{
x3 = x2 + 20;
x4 = x3;
}
else
{
x3 = x2 - 20;
x4 = x3 - 100;
}
document.write("<v:oval id='_x0000_s1027' style='position:absolute;left:" + (x1 - 2) + "px;top:" + (y1 - 2) + "px;width:4px;height:4px; z-index:2' fillcolor='#111111' strokecolor='#111111'/>");
document.write("<v:line id='_x0000_s1025' alt='' style='position:absolute;left:0;text-align:left;top:0;z-index:1' from='" + x1 + "px," + y1 + "px' to='" + x2 + "px," + y2 + "px' coordsize='21600,21600' strokecolor='#111111' strokeweight='1px'></v:line>");
document.write("<v:line id='_x0000_s1025' alt='' style='position:absolute;left:0;text-align:left;top:0;z-index:1' from='" + x2 + "px," + y2 + "px' to='" + x3 + "px," + y2 + "px' coordsize='21600,21600' strokecolor='#111111' strokeweight='1px'></v:line>");
document.write("<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:" + x4 + "px;top:" + (y2 - 10) + "px;width:100px;height:20px;z-index:1'>");
document.write("<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='left'>" + total[0][i] + " " + Math.round(parseFloat(total[1][i] * 100/ totalpie)*100)/100 + "%</td></tr></table></v:textbox></v:shape>")
TempPie += total[1][i]/totalpie;
}
}
}
function getQueryString(name)
{
// 如果链接没有参数,或者链接中不存在我们要获取的参数,直接返回空
if(location.href.indexOf("?")==-1 || location.href.indexOf(name+'=')==-1)
{
return '';
}

// 获取链接中参数部分
var queryString = location.href.substring(location.href.indexOf("?")+1);

// 分离参数对 ?key=value&key2=value2
var parameters = queryString.split("&");

var pos, paraName, paraValue;
for(var i=0; i<parameters.length; i++)
{
// 获取等号位置
pos = parameters[i].indexOf('=');
if(pos == -1) { continue; }

// 获取name 和 value
paraName = parameters[i].substring(0, pos);
paraValue = parameters[i].substring(pos + 1);

// 如果查询的name等于当前name,就返回当前值,同时,将链接中的+号还原成空格
if(paraName == name)
{
return unescape(paraValue.replace(/\+/g, " "));
}
}
return '';
}

</script>

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<!--[if !mso]>
<style>
v\:* { behavior: url(#default#VML) }
o\:* { behavior: url(#default#VML) }
.shape { behavior: url(#default#VML) }
</style>
<![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<style type="text/css">
TD
{
font-size: 9pt;
}
</style>
</head>
<body>

<script type="text/javascript">
//=============调用方法=====================

var IndexArrRemove=-1;
var dataArray = new Array()
var dataStr = getQueryString('dataStr');
dataArray = dataStr.split(",");
dataArray.pop();
for(var i=0;i<dataArray.length;i++)
{
dataArray[i]=parseInt(dataArray[i]);
}
var nameArray = new Array()
var nameStr = getQueryString('nameStr');
nameArray = nameStr.split(",");
nameArray.pop();
var total = new Array(nameArray, dataArray)

table3(total,200,100,320,300,"B");
</script>

</body>
</html>
这个页面就是显示一个饼型图,通过前一个页面传参过来显示!! 急救
...全文
134 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
xuexiaodong2009 2011-06-28
  • 打赏
  • 举报
回复
使用火狐的firebug调试把
一切为了你 2011-06-28
  • 打赏
  • 举报
回复
显示一个空白页面
kyzy_yy_pm 2011-06-28
  • 打赏
  • 举报
回复
关键是ie6也没有啊
chendong_j 2011-06-28
  • 打赏
  • 举报
回复
不是连错误提示都没有吧
ma1986 2011-06-28
  • 打赏
  • 举报
回复
这个不好说的 你最好在火狐的web控制台下调试查看问题出在哪儿嘛 有一种可能是调用的系统方法火狐不支持IE支持

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧