日期:2014-05-19  浏览次数:20405 次

DW里面的热点(map)里面如何触发事件呢?各位大侠帮帮忙,看看是否可行
在DW里面有个热点
<map   name= "Map ">
            <area   shape= "rect "   coords= "20,15,150,42 "   href= "S002.aspx ">
</map>

就是点击图片的某一块,然后转到另外个画面上(以上代码就是这个作用)

但是我想在点击的时候不转画面,而是想判断,然后与数据库做操作,如更新数据库某个字段,请问,该怎么写呢?

谢谢

------解决方案--------------------
onclick = "javascrip:location.href=other.html "
------解决方案--------------------
利用AJAX可以实现
1.服务器端:
1)注册Ajax.
在WebConfig中的configuration节点的system.web节点中添加
<httpHandlers>
<add verb= "POST,GET " path= "ajax/*.ashx " type= "Ajax.PageHandlerFactory, Ajax " />
</httpHandlers>
2)添加引用Ajax.dll到项目中
3)注册Ajax到名为WebForm1的页面
Ajax.Utility.RegisterTypeForAjax(typeof(WebForm1)); //Ajax注册
4)在页面中添加Ajax方法
[AjaxMethod]
public string ReturnA()
{
this.Title = "测试 ";
}
2.客户端:
1)添加JS脚本
<script language= "javascript " type= "text/javascript ">
function a()
{
var title= WebForm1.ReturnA(b);
alert(title);
}
</script>
2)在页面放一个名为Label1的Label的服务器控件
<map name= "Map ">
<area shape= "rect " coords= "21,79,115,104 " onClick= "a(); " href= "javascript:void(0) ">
</map>