onmousedown后拖动鼠标,
要结束画线双击就可以了相关VML的资料可以到:
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/vml/shape/introduction.asp
要结束画线双击就可以了相关VML的资料可以到:
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/vml/shape/introduction.asp
<head>
<title>图表</title>
<STYLE>
v\:* {
BEHAVIOR: url(#default#VML)
}
.Chart{
COLOR: black; FONT-FAMILY: "宋体"; FONT-SIZE: 9.2pt; TEXT-ALIGN: right;
}
</STYLE>
</head>
<script language="JavaScript">
function drawLines()
{
var count=0;//画纵坐标
for(var i=0;i<=48;i++){
var px=200+90*i;
var newLine = document.createElement("<v:line from='"+px+" 200' to='"+px+" 2800' style='position:absolute;z-index:7'></v:line>");
group1.insertBefore(newLine);
if(count%4!=0){
var newStroke = document.createElement("<v:stroke dashstyle='dot' color='silver'/>");
newLine.insertBefore(newStroke);
}
else
{
var newStroke = document.createElement("<v:stroke color='silver'/>");
newLine.insertBefore(newStroke);
}
count++;
}
count=0; //画横坐标
for(var i=0;i<=35;i++){
var py=2800-73*count;
var newLine = document.createElement("<v:line from='200 "+py+"' to='4650 "+py+"' style='position:absolute;z-index:7'></v:line>");
group1.insertBefore(newLine);
if(count%5!=0){
var newStroke = document.createElement("<v:stroke dashstyle='dot' color='silver'/>");
newLine.insertBefore(newStroke);
}
else
{
var newStroke = document.createElement("<v:stroke color='#c5c9c5' />");
newLine.insertBefore(newStroke);
}
count++;
}
drawPoint();
}
var PointX=new Array(24);
for(var i=0;i<24;i++)
{
PointX[i]=Math.round(35*Math.random(1));
}function drawPoint()
{
var strPath="";
for(var i=0;i<=24;i++){
var tempx=200+90*i*2;
var tempy=2800-73*PointX[i];
strPath+=" "+tempx+","+tempy;
//var newPoint = document.createElement("<v:oval fillcolor=red style='position:absolute;left:"+tempx+";top:"+tempy+";width:20px;height:20px;z-index:9'></v:oval>");
}
//temp.innerText="<v:shape fillcolor=red style='position:absolute;z-index:9' path='"+strPath+"'></v:shape>";
var newPoint = document.createElement("<v:polyline filled ='f' style='POSITION:absolute;z-index:9' points='"+strPath+"' />");
group1.insertBefore(newPoint);
}
</script>
<body onload="drawLines();">
<DIV>
<v:group ID="group1" style="WIDTH:500pt;HEIGHT:300pt;" coordsize = "5000,3000">
<v:line from="200 100" to="200 2800" style="position:absolute;z-index:8" strokeweight="1pt" />
<v:line from="150 200" to="200 100" style="position:absolute;z-index:8" strokeweight="1pt" />
<v:line from="200 100" to="250 200" style="position:absolute;z-index:8" strokeweight="1pt" />
<P class="Chart" style="LEFT:40px;TOP:20px;POSITION:absolute;z-index:9;HEIGHT:5.6pt;TEXT-ALIGN:center;">风速(米/秒)</P><v:line from="200 2800" to="4800 2800" style="position:absolute;z-index:8" strokeweight="1pt" />
<v:line from="4700 2750" to="4800 2800" style="position:absolute;z-index:8" strokeweight="1pt" />
<v:line from="4800 2800" to="4700 2850" style="position:absolute;z-index:8" strokeweight="1pt" /><v:rect style="WIDTH:5000px;HEIGHT:3000px;" coordsize="21600,21600" fillcolor="white">
<v:shadow on="t" type="single" color="silver" offset="5pt,3pt"></v:shadow>
</v:rect><v:rect style="LEFT:40px;TOP:40px;POSITION:absolute;WIDTH:4930px;HEIGHT:2930px;" coordsize="21600,21600" fillcolor="white" strokeweight="1.5pt">
</v:rect>
<P class="Chart" style="LEFT:10px;TOP:365px;POSITION:absolute;HEIGHT:5.6pt;TEXT-ALIGN:center;WIDTH:11.9pt">0.0</P>
<P class="Chart" style="LEFT:10px;TOP:320px;POSITION:absolute;HEIGHT:5.6pt;TEXT-ALIGN:center;WIDTH:11.9pt">0.5</P>
<P class="Chart" style="LEFT:10px;TOP:270px;POSITION:absolute;HEIGHT:5.6pt;TEXT-ALIGN:center;WIDTH:11.9pt">1.0</P>
<P class="Chart" style="LEFT:10px;TOP:225px;POSITION:absolute;HEIGHT:5.6pt;TEXT-ALIGN:center;WIDTH:11.9pt">1.5</P>
<P class="Chart" style="LEFT:10px;TOP:175px;POSITION:absolute;HEIGHT:5.6pt;TEXT-ALIGN:center;WIDTH:11.9pt">2.0</P>
<P class="Chart" style="LEFT:10px;TOP:125px;POSITION:absolute;HEIGHT:5.6pt;TEXT-ALIGN:center;WIDTH:11.9pt">2.5</P>
<P class="Chart" style="LEFT:10px;TOP:80px;POSITION:absolute;HEIGHT:5.6pt;TEXT-ALIGN:center;WIDTH:11.9pt">3.0</P>
<P class="Chart" style="LEFT:10px;TOP:30px;POSITION:absolute;HEIGHT:5.6pt;TEXT-ALIGN:center;WIDTH:11.9pt">3.5</P><P class="Chart" style="LEFT:20px;TOP:380px;POSITION:absolute;HEIGHT:5.6pt;TEXT-ALIGN:center;">20时</P>
<P class="Chart" style="LEFT:68px;TOP:380px;POSITION:absolute;HEIGHT:5.6pt;TEXT-ALIGN:center;">22时</P>
<P class="Chart" style="LEFT:118px;TOP:380px;POSITION:absolute;HEIGHT:5.6pt;TEXT-ALIGN:center;">0时</P>
<P class="Chart" style="LEFT:165px;TOP:380px;POSITION:absolute;HEIGHT:5.6pt;TEXT-ALIGN:center;">2时</P>
<P class="Chart" style="LEFT:215px;TOP:380px;POSITION:absolute;HEIGHT:5.6pt;TEXT-ALIGN:center;">4时</P>
<P class="Chart" style="LEFT:265px;TOP:380px;POSITION:absolute;HEIGHT:5.6pt;TEXT-ALIGN:center;">6时</P>
<P class="Chart" style="LEFT:310px;TOP:380px;POSITION:absolute;HEIGHT:5.6pt;TEXT-ALIGN:center;">8时</P>
<P class="Chart" style="LEFT:355px;TOP:380px;POSITION:absolute;HEIGHT:5.6pt;TEXT-ALIGN:center;">10时</P>
<P class="Chart" style="LEFT:405px;TOP:380px;POSITION:absolute;HEIGHT:5.6pt;TEXT-ALIGN:center;">12时</P>
<P class="Chart" style="LEFT:450px;TOP:380px;POSITION:absolute;HEIGHT:5.6pt;TEXT-ALIGN:center;">14时</P>
<P class="Chart" style="LEFT:495px;TOP:380px;POSITION:absolute;HEIGHT:5.6pt;TEXT-ALIGN:center;">16时</P>
<P class="Chart" style="LEFT:545px;TOP:380px;POSITION:absolute;HEIGHT:5.6pt;TEXT-ALIGN:center;">18时</P>
<P class="Chart" style="LEFT:595px;TOP:380px;POSITION:absolute;HEIGHT:5.6pt;TEXT-ALIGN:center;">20时</P></v:group></DIV>
<div id="temp">
</div>
</body>
</html>
国外这方面的应用都很多了...
比如说..地图,统计图表,还有很多的3D动画,都可以用VML完成...
等这个项目完成了,我归纳一下,和大家一起分享..
如果 原来是IE5.0 升级成 IE6.0 然后还原成 IE5.0 好象就不行了..