关于弹出窗口可以移动的问题 哦,只能给你思路,你又不帖完整代码. 把你想要鼠标能拖动的区域另个弄个DIV,获取这个DIV对像进行拖放 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 /* Auth: jingliangliang Date: 2008-5-5 Email: [email protected]*/(function(){ if(typeof Drag != "undefined") { var _Drag = Drag; } //此处声明Drag类 //--elementid:要移动元素的ID var Drag = window.Drag = function(elementid){ var thisDrag = this; this.DifWidth = 0; this.DifHeight = 0; this.thisDivDrag = document.getElementById(elementid); this.thisDivDrag.onmousedown = function(event){ var theevent; var theSrcevent; if(window.event) { theevent = window.event; theSrcevent = window.event.srcElement; } else { theevent =event; theSrcevent =event.target; } thisDrag.DifWidth= theevent.clientX - theSrcevent.offsetLeft; thisDrag.DifHeight = theevent.clientY - theSrcevent.offsetTop; document.body.onmousemove =function(event){ var theevent; if(window.event) { theevent = window.event; } else { theevent =event; } thisDrag.thisDivDrag.style.left = theevent.clientX -thisDrag.DifWidth ; thisDrag.thisDivDrag.style.top = theevent.clientY -thisDrag.DifHeight ; }; document.body.onmouseup =function(event) { document.body.onmousemove = ""; }; }; };})();========================调用<HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <script type="text/javascript" src="DragClass.js"></script> <script type="text/javascript"> window.onload=function(){ __Drag = new Drag("div1"); }; </script> </HEAD> <BODY> <div id="div1" style="background-color:red;width:100px;height:100px;border:1px solid #666666;position: absolute;">test</div> </BODY></HTML> 父窗口传递信息给子窗口看代码实例:<script language=javascript>function outPut(){ //获取父窗口的文本信息赋值给text var text = document.abc.text.value; //打开子窗口,并且把操作句柄赋值给win变量,以下所有操作都是针对win对象的 var win = window.open("","mywin", "menubar=no,width=400,height=100,resizeable=yes"); //输出基本信息 win.document.writeln("<title>输出结果</title>"); win.document.writeln("你的信息是:<p>"); //输出从父窗口获取的信息 win.document.writeln(text); win.document.close(); win.focus();}</script><form name=abc method=post><input type=text name=text size=50>//调用上面的函数<input type=button value=提交 onClick="outPut()"></form>来源:http://www.lamp9.cn/articleshow-6-41560.html 这个往div里添加文本框 ,移动文本框依然会动!!!点文本框不移动的那种,,比如鼠标只能放在标题栏那儿才可以移动!!就好像windows窗口! 那给你段代码你参考下吧。拖动上面的蓝色部分会移动,而拖动其他位置则不移动。和你想要的效果思想是一样的。http://www.cnblogs.com/cloudgamer/archive/2008/11/17/Drag.html 新手的一个小问题 jquery 获取鼠标位置信息的函数是哪个(跨浏览器的) 如何实现浮动广告且刷新网页图片和文字的连接能自动更新 javascript(JQuery)重新赋值时的闪烁问题 急!!!!!!!!!!!! javascript 中如何移出一个对象?? 问两个JS的小问题,谢谢大家 一个验证脚本问题,请帮助! 如何实现关闭网页时,作一相应操作 实在搞不懂---从Java得到的date类型转换为Javascript的date怎么做? (100分求)将浮动框固定在某个table中 变为不可变 基础问题:关于逻辑运算符的返回值问题
Auth: jingliangliang
Date: 2008-5-5
Email: [email protected]
*/
(function(){
if(typeof Drag != "undefined")
{
var _Drag = Drag;
}
//此处声明Drag类
//--elementid:要移动元素的ID
var Drag = window.Drag = function(elementid){
var thisDrag = this;
this.DifWidth = 0;
this.DifHeight = 0;
this.thisDivDrag = document.getElementById(elementid);
this.thisDivDrag.onmousedown = function(event){
var theevent;
var theSrcevent;
if(window.event)
{
theevent = window.event;
theSrcevent = window.event.srcElement;
}
else
{
theevent =event;
theSrcevent =event.target;
}
thisDrag.DifWidth= theevent.clientX - theSrcevent.offsetLeft;
thisDrag.DifHeight = theevent.clientY - theSrcevent.offsetTop;
document.body.onmousemove =function(event){
var theevent;
if(window.event)
{
theevent = window.event;
}
else
{
theevent =event;
}
thisDrag.thisDivDrag.style.left = theevent.clientX -thisDrag.DifWidth ;
thisDrag.thisDivDrag.style.top = theevent.clientY -thisDrag.DifHeight ;
};
document.body.onmouseup =function(event)
{
document.body.onmousemove = "";
};
};
};
})();
========================调用<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script type="text/javascript" src="DragClass.js"></script>
<script type="text/javascript">
window.onload=function(){
__Drag = new Drag("div1");
};
</script>
</HEAD> <BODY>
<div id="div1" style="background-color:red;width:100px;height:100px;border:1px solid #666666;position: absolute;">test</div>
</BODY>
</HTML>
<script language=javascript>function outPut()
{
//获取父窗口的文本信息赋值给text
var text = document.abc.text.value;
//打开子窗口,并且把操作句柄赋值给win变量,以下所有操作都是针对win对象的
var win = window.open("","mywin", "menubar=no,width=400,height=100,resizeable=yes");
//输出基本信息
win.document.writeln("<title>输出结果</title>");
win.document.writeln("你的信息是:<p>");
//输出从父窗口获取的信息
win.document.writeln(text);
win.document.close();
win.focus();
}
</script><form name=abc method=post>
<input type=text name=text size=50>
//调用上面的函数
<input type=button value=提交 onClick="outPut()"></form>来源:http://www.lamp9.cn/articleshow-6-41560.html
http://www.cnblogs.com/cloudgamer/archive/2008/11/17/Drag.html