js绘线

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>

</head>
<script language="javascript">

function huadian(x,y){
document.write("<div style='height:3px;position:absolute;left:"+x+"px;top:"+y+"px;width:5px;background:#f00;'></div>")
}
function cycle(cx,cy,r){
//r wei r
var cyclex,cycley,radio;
var pi=Math.PI;
huadian(cx,cy);
//花半径r

//如何取到以半径为r的画圆的所有的坐标呢?
for(var i=0;i<360;i+=0.5){
radio=i*pi/180;
cyclex=r*Math.cos(radio)+cx;
cycley=r*Math.sin(radio)+cy;
huadian(cyclex,cycley);
}
}

//斜率求y柱
function playLine(x1,y1,x2,y2){
var slope=(y2-y1)/(x2-x1);
var distance=x2-x1;
if(distance>0){
for(var i=0;i<distance;i++){
var y=y1+i*slope;
var x=x1+i;
huadian(x,y);
}
} else if(distance<0){
for(var j=0;j>distance;j--){
var x=x1+j;
var y=y1+j*slope;
huadian(x,y);
}
}else {
temp=y2-y1;
if(temp>0){
for(var a=0;a<temp;a++){
x=x1;
y=y1+a;
huadian(x,y);
}
}else{
for(var b=0;b>temp;b--){
x=x1;
y=y1+temp;
huadian(x,y);
}
}
}
//画垂直线单独考虑
}
//画矩形
function ractanglePlay(x1,y1,high,width){
if(high>0 && width>0){
for(var i=0;i<width;i++){//画宽
x=x1+i;
y=y1;
huadian(x,y);
huadian(x,y+high);
}
for(var j=0;j<high;j++){//画高
x=x1;
y=y1+j;
huadian(x,y);
huadian(x+width,y);
}

}

}
cycle(500,300,300);//画圆
playLine(500,300,500,700); //画直线
playLine(100,300,1000,200);
playLine(1000,200,100,500);
playLine(500,300,100,500);
ractanglePlay(300,600,100,500);//画矩形

</script>


</body>
</html>

打开一个窗体

<script type="text/javascript">
function markmappoint(){
popwin=window.open('../query/mapmark/mapPointMarkFind.action','pointmarkMap','toolbar=no,location=no,directories=no,+status=no,menubar=no,scrollbars=no,+resizable=yes,width=1000,height=800,left=120,top=120');
}

</script>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值