图片拖动怎么做 把图片放到层里拖动div的例子到处都是 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 将IMG的STYLE position:absolute 就可以设定LEFT 和 TOP ,写鼠标事件就可以拖动了。 我也正做,写了可以拖,但为什么出现windwos的禁止拖拽的光标,我DIV里是个IMAGE高手指点 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>无标题文档</title><link href="css.css" rel="stylesheet" type="text/css" /><script language="javascript" > var m_img1; var moving = false; function startUp() { m_img1 = document.getElementById("img1"); m_img1.onmousedown = handleMouseDown; m_img1.onmousemove = handleMouseMove; m_img1.onmouseup = handleMouseUp; } function handleMouseDown() { m_img1.setCapture(); moving = true; } function handleMouseMove() { if (moving) { m_img1.style.left = event.clientX; m_img1.style.top = event.clientY; } } function handleMouseUp() { m_img1.releaseCapture(); moving = false; }</script></head><body onload="startUp()"> <form action="" method="post"> <img src="" id="img1" style="position:absolute;"> </form></body></html> <img ondrag="return false;" 图片加上 ondrag="return false;" 就行了 托动只能在IE中进行吧。http://badwish.70.hezu1.com/endlesswall/这里面有托动的实例。看里面源代码,我觉得我写的挺清楚的了(IE可以其它不行)。 js读写文件 求助怎么实现边框切换呢? Ext 日期比较 firefox 和 窗体右上角的叉 怎么把滚动的层改成滚动时不抖动,而是慢慢滑动 有什么办法可以给htc文件中的函数传参数吗?(请高手指点) JS 地区效果 徐祖宁,徐兄请进 求解:easyui datagrid中行编辑时combobox为可编辑,输入中文未返回空字符串 JavaScript 运行时错误: 对象不支持“live”属性或方法 求大神指教 祝:大家元旦快乐,顺便问个问题。。。 能否用代码控制WEB页面打印时页面的大小,急忙!
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<link href="css.css" rel="stylesheet" type="text/css" />
<script language="javascript" >
var m_img1;
var moving = false;
function startUp()
{
m_img1 = document.getElementById("img1");
m_img1.onmousedown = handleMouseDown;
m_img1.onmousemove = handleMouseMove;
m_img1.onmouseup = handleMouseUp;
}
function handleMouseDown()
{
m_img1.setCapture();
moving = true;
}
function handleMouseMove()
{
if (moving)
{
m_img1.style.left = event.clientX;
m_img1.style.top = event.clientY;
}
}
function handleMouseUp()
{
m_img1.releaseCapture();
moving = false;
}
</script>
</head>
<body onload="startUp()">
<form action="" method="post">
<img src="" id="img1" style="position:absolute;">
</form>
</body>
</html>
http://badwish.70.hezu1.com/endlesswall/
这里面有托动的实例。看里面源代码,我觉得我写的挺清楚的了(IE可以其它不行)。