记录鼠标轨迹生成vml曲线图程序(可模拟签名)

<html xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<title>签名研究</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<STYLE>
 v/:* { BEHAVIOR: url(#default#VML) }
body {
 margin-left: 0px;
 margin-top: 0px;
 margin-right: 0px;
 margin-bottom: 0px;
 cursor:url(pen_i.cur);
}
.p1{cursor:url(pen_i.cur)}
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
//作者坚信科学技术是第一生产力,努力向技术更高峰攀登。决定了就要去做,做就要做好!
var flag  = 0;
var ind   = 0; //曲线段计数
var indNb = 0; //曲线段内部坐标计数
var point = new Array();
var xian  = "";
function microsoftMouseMove() {
 if ((window.event.x != document.all.x.value || window.event.y != document.all.y.value) && flag==1) {
  document.all.x.value = window.event.x;
  document.all.y.value = window.event.y;

  point[ind][indNb] = window.event.x + "," + window.event.y; //记录鼠标x,y坐标
  xian += point[ind][indNb] + " ";

  indNb += 1; //点数累加
 }
}

function msDown() {
 xian = "";
 xian = "<v:PolyLine style='POSITION:absolute;Z-INDEX:1;WIDTH:1;HEIGHT:1;TOP:0;LEFT:0' filled='false' Points='"
 point[ind] = new Array();
 indNb = 0; //新线段开始,点数清零
 point[ind][indNb] = window.event.x + "," + window.event.y; //记录鼠标x,y坐标
 xian  += point[ind][indNb] + " ";
 indNb += 1; //点数累加
 flag = 1;
}

function msUp() {
 flag = 0;
 ind += 1; //线段数累加
 if (xian != "") {
  xian += "'/>";
  newPoint = document.createElement(xian);
  group1.appendChild(newPoint);
  parent.document.all.txt.value += xian + "/n";
 }
}

function printXd() {
 lin = point.length;
 str = "";
 for (i=0; i<lin; i++) {
  ct  = point[i].length;
  str += "<v:PolyLine style='POSITION:absolute;Z-INDEX:1;WIDTH:1;HEIGHT:1;TOP:0;LEFT:0' filled='false' Points='"
  for (j=0; j<ct; j++) {
   str += point[i][j] + " ";
  }
  str += "'/>/n";
 }
}
</SCRIPT>
<body bgcolor="#fef4d9" οnmοusemοve="microsoftMouseMove()" οnmοusedοwn="msDown()" οnmοuseup="msUp()" onselectstart="return false;">
<div id=test style="display:none;">
 <input type="text" name="x" size="4"><input type="text" name="y" size="4">
</div>
<v:group ID="group1" style="WIDTH:200px;HEIGHT:175px;TOP:0;LEFT:0" coordsize="200,200"></v:group>
</body>
</html>

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值