设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
楼主: fannky
打印 上一主题 下一主题

[宏/菜单/工具栏] [分享][推荐]我也说说窗体上移动控件(代码少少)

[复制链接]
21#
发表于 2006-5-31 03:31:00 | 只看该作者
现在正需要正网页上移动用户控件呢,具体有例子吗
22#
发表于 2006-5-31 07:31:00 | 只看该作者

hao

以下是引用fannky在2006-5-22 11:31:00的发言:
刚刚看到有发表再创提上移动控件的贴子,看了看,就是觉得代码长。不过功能到挺全面,支持键盘移动!本人收藏了一个范例,虽然只支持鼠标拖动,但是代码少少,有兴趣不妨看看
23#
发表于 2006-6-1 05:00:00 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
24#
 楼主| 发表于 2006-6-5 19:47:00 | 只看该作者

回复:(kinglou)现在正需要正网页上移动用户控件呢,...

以下是引用kinglou在2006-5-30 19:31:00的发言:
现在正需要正网页上移动用户控件呢,具体有例子吗



这是JSP涉及的东东

<html>
<body>
<script language="javascript">
var IE5=(document.getElementById && document.all)? true : false;
var W3C=(document.getElementById)? true: false;
var currIDb=null, currIDs=null, xoff=0, yoff=0; zctr=0; totz=0;
function trackmouse(evt){
if((currIDb!=null) && (currIDs!=null)){
var x=(IE5)? event.clientX+document.body.scrollLeft : evt.pageX;
var y=(IE5)? event.clientY+document.body.scrollTop : evt.pageY;
currIDb.style.left=x+xoff+'px';
currIDs.style.left=x+xoff+10+'px';
currIDb.style.top=y+yoff+'px';
currIDs.style.top=y+yoff+10+'px';
return false;
}}

function stopdrag(){
currIDb=null;
currIDs=null;
NS6bugfix();
}

function grab_id(evt){
xoff=parseInt(this.IDb.style.left)-((IE5)? event.clientX+document.body.scrollLeft : evt.pageX);
yoff=parseInt(this.IDb.style.top)-((IE5)? event.clientY+document.body.scrollTop : evt.pageY);
currIDb=this.IDb;
currIDs=this.IDs;
}

function NS6bugfix(){
if(!IE5){
self.resizeBy(0,1);
self.resizeBy(0,-1);
}}

function incrzindex(){
zctr=zctr+2;
this.subb.style.zIndex=zctr;
this.subs.style.zIndex=zctr-1;
}

function createPopup(id, title, width, height, x , y , isdraggable, boxcolor, barcolor, shadowcolor, text, textcolor, textptsize, textfamily ){
if(W3C){
zctr+=2;
totz=zctr;
var txt='';
txt+='<div id="'+id+'_s" style="position:absolute; left:'+(x+10)+'px; top:'+(y+10)+'px; width:'+width+'px; height:'+height+'px; background-color:'+shadowcolor+'; filter:alpha(opacity=50); visibility:visible">&nbsp;</div>';
txt+='<div id="'+id+'_b" style="borderutset '+barcolor+' 2px; position:absolute; left:'+x+'px; top:'+y+'px; width:'+width+'px; overflow:hidden; height:'+height+'px; background-color:'+boxcolor+'; visibility:visible">';
txt+='<div style="width:'+width+'px; height:16px; background-color:'+barcolor+'; padding:0px; border:1px"><table cellpadding="0" cellspacing="0" border="0" width="'+(IE5? width-4 : width)+'"><tr><td width="'+(width-20)+'"><div id="'+id+'_h" style="width:'+(width-20)+'px; height:14px; font: bold 12px sans-serif; color:'+textcolor+'">&nbsp;'+title+'</div></td><td align="right"><a ><img src="close.gif" border="0" height="15" width="15"></a></td></tr></table></div>';
txt+='<div id="'+id+'_ov" width:'+width+'px; style="margin:2px; color:'+textcolor+'; font:'+textptsize+'pt '+textfamily+';">'+text+'</div></div>';
document.write(txt);
this.IDh=document.getElementById(id+'_h');
this.IDh.IDb=document.getElementById(id+'_b');
this.IDh.IDs=document.getElementById(id+'_s');
this.IDh.IDb.subs=this.IDh.IDs;
this.IDh.IDb.subb=this.IDh.IDb;
this.IDh.IDb.IDov=document.getElementById(id+'_ov');
if(IE5){
this.IDh.IDb.IDov.style.width=width-6;
this.IDh.IDb.IDov.style.height=height-22;
this.IDh.IDb.IDov.style.scrollbarBaseColor=boxcolor;
this.IDh.IDb.IDov.style.overflow="auto";
}else{
this.IDh.IDs.style.MozOpacity=.5;
}
this.IDh.IDb.onmousedown=incrzindex;
if(isdraggable){
this.IDh.onmousedown=grab_id;
this.IDh.onmouseup=stopdrag;
}}}

if(W3C)document.onmousemove=trackmouse;
if(!IE5 && W3C)window.onload=NS6bugfix;
createPopup( 'box3', '用鼠标可以移动此窗口!' ,  288, 90, 28, 200, true, 'FF9D6F' , '723838' , '800000' , '你需要什么效果?' , 'FFFFFF' , 9 , '宋体');
</script>
</body>
</html>
25#
发表于 2006-6-6 00:28:00 | 只看该作者
26#
发表于 2006-6-7 00:38:00 | 只看该作者
look
27#
发表于 2006-6-7 01:35:00 | 只看该作者
[em02][em02][em02]
28#
发表于 2006-6-13 16:46:00 | 只看该作者

支持!

支持
29#
发表于 2006-7-6 23:22:00 | 只看该作者
教教我吧
30#
发表于 2006-7-7 01:01:00 | 只看该作者
让我看看.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-3 05:59 , Processed in 0.131443 second(s), 33 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表