我有一个div 我想让鼠标移动到左右两边框时鼠标形状为左右箭头 移动到上下边框时 鼠标箭头为上下箭头 请问怎么实现呀 能否给一段代码
解决方案 »
- Extjs 求扩展的日期时间控件
- JQuery求助
- js双日历控件,急急急
- 自定义一个类,类内部使用DOM方法生成一些网页元素,例如button,如何将onclick定义为调用这个类的某个方法?
- 300分的问题 同时给上一个在线配色程序!!
- 找javascript,asp.net二年以上经验 在深圳5K左右,QQ:15218231
- 怎么样才能点击图片时<iframe></iframe>中的内容发生变化
- 菜鸟问的高水平问题,不够加分,见者有份。
- 关于层,在一个页面中怎样才能自动刷新另一个页面中的一个层。
- TABLE行,根据SHIFT、CTRL连续“涂黑”选中、分别拾取“涂黑”选中
- 【求助】JS+ASP里面的QueryString
- 怎么把这两个asp文件中的vbscript转为javascript?
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>test</title>
<script>
function changeCursor(o,e){
e = e?e:window.event;
var x=y=0;
if(e.offsetX){
x=e.offsetX;
y=e.offsetY;
}else{
var pos = getPosition(o);
x=e.layerX-pos[0];
y=e.layerY-pos[1];
}
var l=3;//敏感程度
if((x<l&&y<l)||(o.offsetWidth-x<l&&o.offsetHeight-y<l)){
o.style.cursor='NW-resize';
}else if((x<l&&o.offsetHeight-y<l)||(o.offsetWidth-x<l&&y<l)){
o.style.cursor='NE-resize';
}else if(x<l||o.offsetWidth-x<l){
o.style.cursor='E-resize';
}else if(y<l||o.offsetHeight-y<l){
o.style.cursor='N-resize';
}else{
o.style.cursor='';
}
}function getPosition(o){
var x=y=0;
do{
x+=o.offsetLeft;
y+=o.offsetTop;
o=o.parentNode;
}while(o.tagName!='BODY');
return [x,y];
}
</script>
</head><body>
<div style="background-color:red;width:100px;height:100px" onmousemove="changeCursor(this,event)"></div>
</body></html>