日期:2014-05-16  浏览次数:20422 次

firefox下用vml画扇形统计图的问题,高手请进啊!
各位, 最近问问题比较多,这里剩下最后10分啦,抱歉!精通firefox下用vml画扇形统计图的请进啊!
本人做了一个扇形统计图。在ie7下运行通过,但是在firefox下运行不能通过,请大家指点指点啊,示例代码如下:



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
<html xmlns:v="urn:schemas-microsoft-com:vml">
<head >
  <title >VML Pie </title >
<STYLE >
v\:* { BEHAVIOR: url(#default#VML) }
</STYLE>
<script type="text/javascript" >


var r=100;
function showDiv(){
  var i=50;
  var m=10;
  var n=10;
  var insertTD=document.getElementById("insertTD");

  for(var j=0;j <4;j++){
  //add object div
  var divv=document.createElement("div");
divv.className='divLayer';
  divv.setAttribute("id","div"+j);
  divv.style.zIndex=j;
  divv.style.display="block";
  divv.style.left=200+i;
  divv.style.top=200+i;
divv.style.position='absolute';
  divv.style.border='solid';
divv.style.borderWidth='thin thin thin thin';
divv.style.borderColor='#000000 black black #000000';

showPie('40','30',divv);
//divv.onclick=click;
document.body.appendChild(divv);
  i+=50;
  m+=5;
  n+=5;
  }
}


function click(){
  alert(0);
}



function createPie(sa,ea,color,n,divObject)
{
  var fs=Math.PI*2*(sa/360);
  var fe=Math.PI*2*(ea/360);
  var sx=parseInt(r*Math.sin(fs));
  var sy=parseInt(-r*Math.cos(fs));
  var ex=parseInt(r*Math.sin(fe));
  var ey=parseInt(-r*Math.cos(fe));
  //alert('sx:'+sx+' sy:'+sy+' ex:'+ex+' ey:'+ey);
  var newPie=document.createElement("<v:shape title='"+n+"' style='position:absolute;z-index:8;left:150;top:128;width:"+2*r+"px;height:"+2*r+"px' CoordSize='400,400' strokeweight='2pt' fillcolor='"+color+"' strokecolor='black' path='m0,1 l "+sx+","+sy+" ar -200,-200,200,200,"+ex+","+ey+","+sx+","+sy+" l0,1 x e'/>");
  divObject.insertBefore(newPie);
  return newPie;
}

function showPie(oneValue,threeValue,divObject)
{
  createPie(0,parseInt(threeValue)*3.6,"#0000FF","Three",divObject);
  createPie(parseInt(threeValue)*3.6,parseInt(threeValue)*3.6+parseInt(oneValue)*3.6,"#FF0000","One",divObject);
  createPie(parseInt(threeValue)*3.6+parseInt(oneValue)*3.6,360,"#00FF00","Two",divObject);
}




</script>
<style type="text/css" >

.divLayer{  
  width:300px;
  height:256px;
  background-color:#FFFFFF;
  border: solid; border-width: thin thin thin thin; border-color: #000000 black black #000000;
}

.percentLayer{
position:absolute;left:600px;top:400px;z-index:30; width:120;height:30;background-color:#CCCCCC;filter:Alpha(opacity=90);opacity:0.9;visibility:hidden;border-style:solid;valign=middle;
}

</style>
</head >
  <body bgcolor="">
<table >
<tr >
<td id='insertTD'> </td >
</tr >
</table >
  <script type="text/javascript">
showDiv();
//showPercent();
  </script>
  </body >
</htm