用JavaScript绘图 ——JS2D函数集

<SCRIPT language=JavaScript type=text/JavaScript>
	var isdrag = false;
	function img_zoom(e, o) //图片鼠标滚轮缩放

	{
		var zoom = parseInt(o.style.zoom, 10) || 100;
		zoom += event.wheelDelta / 12;
		if (zoom > 0)
			o.style.zoom = zoom + '%';
		return false;
	}
	function mouseover() {
		div1.border = "1";
		div1.style.cursor = "nw-resize";
	}
	function mouseout() {
		div1.border = "0";
	}
	function mousemove() {
		if (isdrag) {
			div1.style.width = event.clientX;
			//div1.style.height=event.clientY;
		}
	}
	function mousedown() {
		div1.setCapture();
		isdrag = true;
		div1.onmousemove = mousemove;
	}
	function mouseup() {
		div1.releaseCapture();
		isdrag = false;
		//event.returnValue=false;
	}
</SCRIPT>
<IMG onmouseover="mouseover()" onmouseout="mouseout()"
  onmouseup="mouseup()" onmousedown="mousedown()" id="div1"
  onmousewheel="return img_zoom(event,this)" alt="鼠标的滚轮控制图片自动缩放"
  src="http://www.java2000.net/images/company/www.java2000.net.gif"
  onload="javascript:if(this.width>screen.width-500)this.width=screen.width-500">

 

你可能感兴趣的:(JavaScript,.net)