Javascript:在mousemove事件上绘制一个矩形

时间:2012-08-20 10:08:47

标签: c# javascript asp.net

如何在asp.net(C#)中使用javascript在已绘制的圆(孔)上绘制一个矩形。我在页面中将我的圆圈绘制为位图。应该在mousemove事件上绘制矩形。

1 个答案:

答案 0 :(得分:1)

在img标签中写下以下代码:

<img name="picture" src="Images/circle.jpg" alt="My Image"    
     onmouseover="document.picture.src=image2.src" 
     onmouseout="document.picture.src=image1.src" />

并且所需的javascript是:

<script language="Javascript" type="text/javascript">
    image1 = new Image
    image1.src = "Images/circle.jpg"
    image2 = new Image
    image2.src = "Images/squre.jpg"
</script>