function move(){
if (MOVEOBJ == null) { return false; }
MOVEFLAG = true;
newX = event.x;
newY = event.y;
var arr = new Array();
try
{
arr = MOVEOBJ.Points.value.split(",");
var pp=arr[0] + ',' + arr[1] + ' ' + (newX) + 'pt,' + (newY) + ' '+ arr[4] + ',' + arr[5];
MOVEOBJ.outerHTML="<v:PolyLine id='p2' filled='false' Points='"+pp+"' onmousedown='moveIt(this);' style='position:absolute'/> ";
}
catch(e){}
}
if (MOVEOBJ == null) { return false; }
MOVEFLAG = true;
newX = event.x;
newY = event.y;
var arr = new Array();
try
{
arr = MOVEOBJ.Points.value.split(",");
var pp=arr[0] + ',' + arr[1] + ' ' + (newX) + 'pt,' + (newY) + ' '+ arr[4] + ',' + arr[5];
MOVEOBJ.outerHTML="<v:PolyLine id='p2' filled='false' Points='"+pp+"' onmousedown='moveIt(this);' style='position:absolute'/> ";
}
catch(e){}
}
解决方案 »
- js弹出div里面定义的事件提示未定义怎么解决,明明定义了的了。
- Toggle问题
- 注册表修改参数后设置为虾米没变化呀
- 求各位大侠了。。javascript 权威指南18-3 表单验证?validate 但是第一个文本框无法输入正确格式 求指正
- 如何实现WebBrowser控件的自动横向打印设置?
- $("item_code")说什么意思+js
- 关于RegExp对象的使用,不能正确执行,里面不能变量时,直接用正则表达式还能正确执行的。?
- 多个同名input,如何判断或定位当前的录入位置?
- 怎样检查用户输入的email地址中是否含@?
- 如何用javascript在页面找到并隐藏文字内容?
- 从屏幕的右下角慢慢爬上来的窗口
- 正则表达式问题,高手请进来指点!多谢了!
<v:PolyLine id='pl' filled="false" Points="0,0 100,0 200,0"
onmousedown='moveIt(this);' style="position:absolute"/><v:PolyLine id='p2' filled="false" Points="100pt,100pt 200pt,50pt 300pt,100pt" onmousedown="moveIt(this);" style="position:absolute"/>
</body>
现在比如说我拖动一个L字型的折线,我要做的是,向左拖动折线,最右边的点在页面上显示的位置不变。则需要改动的不止是第一个点以及第二个点的坐标,同时还要改动第三个(最右边)点的坐标,是这样的吗?我现在只想改动Points属性,像上面的重新画该直线很困难。有其它的方法只修改Points吗?
<head>
<style>
v\:*{behavior:url(#default#VML);}
</style>
<script language="javascript">
var MOVEOBJ = null;
var MOVEFLAG = false;
var Po=null;
function moveIt(obj,p){
document.onmousemove = move;
document.onmouseup = drop;
Po=p;
MOVEOBJ = obj;
return true;
}function move(){
if (MOVEOBJ == null) { return false; }
MOVEFLAG = true;
newX = event.x;
newY = event.y;
MOVEOBJ.Points.value = Po[0]+','+Po[1] +','+ newX + ',' + newY +','+ Po[4]+','+Po[5];
event.returnValue = false;
return false;
}function drop(){
if(MOVEFLAG) MOVEFLAG = false;
MOVEOBJ = null;
return true;
}function getPoints(obj)
{
return obj.points.value.split(",");
}</script>
</head>
<body onmousemove="window.status = 'X=' + window.event.x + ' Y='+ window.event.y" >
<v:PolyLine id='pl' filled="false" Points="0,0,100,0,200,0"
onmousedown='moveIt(this,getPoints(this));' style="position:absolute"/>
<v:PolyLine id='p2' filled="false" Points="50,50,100,50,200,100"
onmousedown='moveIt(this,getPoints(this));' style="position:absolute"/>
</body>
</html>
<head>
<style>
v\:*{behavior:url(#default#VML);}
</style><script language="javascript">
var MOVEOBJ = null;
var MOVEFLAG = false;
var Po=null;
var Poid=null;
function moveIt(obj){
document.onmousemove = move;
document.onmouseup = drop;
Po=getPoints(obj);
Poid=obj.id;
MOVEOBJ = obj;
return true;
}function move(){
if (MOVEOBJ == null) { return false; }
MOVEFLAG = true;
newX = event.x;
newY = event.y;
MOVEOBJ.Points.value = Po[0]+','+Po[1] +','+ newX + ',' + newY +','+ Po[4]+','+Po[5];
event.returnValue = false;
return false;
}function drop(){
if(MOVEFLAG) MOVEFLAG = false;
MOVEOBJ = null;
return true;
}function getPoints(obj)
{
if(Po!=null&&Poid==obj.id)return Po;
return obj.points.value.split(",");
}</script>
</head>
<body onmousemove="window.status = 'X=' + window.event.x + ' Y='+ window.event.y" >
<v:PolyLine id='pl' filled="false" Points="0,0,100,0,200,0"
onmousedown='moveIt(this);' style="position:absolute;top:10px;left:10px;"/>
<v:PolyLine id='p2' filled="false" Points="50,50,100,50,200,100"
onmousedown='moveIt(this);' style="position:absolute;top:10px;left:10px;"/>
</body>
</html>