您的位置:无忧脚本
» biyuan老矣
» 日志
漂亮的层模拟窗体MoveWindow(未封装),基本功能兼容FF^_^
上一篇 /
下一篇 2007-04-27 01:23:25
/ 个人分类:JScript编程
查看( 1584 ) /
评论( 11 )
CODE:
<html>
<head>
<title>MoveWindow_Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<style type="text/css">
body {
margin:0px;
}
a:link,a:visited {
color:#450600;
text-decoration:none;
cursor:default;
}
a:hover {
color:#ff0000;
text-decoration:none;
cursor:default;
}
</style>
</head>
<body>
<div id="_alert" style="
position:absolute;
filter:progid:DXImageTransform.Microsoft.DropShadow(color=#c0c0c0,offX=4,offY=4,positives=true);
z-index:100;
top:130px;
left:220px;
width:300px;
font-size:12px;
border:1px solid #cccccc;">
<div style="
filter:Alpha(opacity=50);
width:82%;
height:26px;
float:left;
cursor:move;
line-height:26px;
background:#f0f0f0;
text-indent:3px;"
onmousedown="run('_alert',event);">
<font style="font-size:16px;font-family:wingdings">î</font> <b>无忧脚本论坛</b>
</div>
<div style="
filter:Alpha(opacity=50);
width:18%;
height:26px;
float:left;
font-size:14px;
font-family:webdings;
cursor:default;
line-height:26px;
background:#fffeee;
text-align:right;">
<a href="#" onclick="mix('_alert','_alert_c');">0</a><a href="#" onclick="max('_alert','_alert_c',this);">1</a><a href="#" onclick="cos('_alert');">r</a>
</div>
<div id="_alert_c" style="
filter:Alpha(opacity=50);
width:100%;
height:150px;
padding:10px;
background:#fffff3;
border-top:1px solid #cccccc;">
<br /><br />无忧脚本是个什么组织?<br />
是个学习、讨论、研究JavaScript的地方!
</div>
</div>
<script language="JavaScript">
document.body.oncontextmenu = function(){
window.event.returnValue = false;
}
document.body.onselectstart = function(){
return false;
}
var _ty,_tx,_cy,_cx,_sw_so,_sh_sb;
function run(obj,event){
var _so = document.getElementById(obj);
var _sc = true;
var _sy = event.clientY;
var _sx = event.clientX;
_so.style.background = "#cccccc";
if(_so.style.width == document.body.clientWidth - 4 + "px"){
_sc = false;
}
_so.onmouseup = function(){
_sc = false;
_so.style.background = "";
}
_so.onmousemove = function(){
if(_sc == true){
var _xy = event.clientY - _sy;
var _xx = event.clientX - _sx;
this.style.top = parseInt(this.style.top) + _xy + "px";
this.style.left = parseInt(this.style.left) + _xx + "px";
_sy = event.clientY;
_sx = event.clientX;
}
}
}
function mix(obj1,obj2){
var _so = document.getElementById(obj1);
var _sb = document.getElementById(obj2);
if(_sb.style.display == ''){
_ty = _so.style.top;
_tx = _so.style.left;
_sb.style.display = 'none';
_so.style.left = "0px";
_so.style.top = document.body.clientHeight - 32 + "px";
}
else {
_sb.style.display = '';
_so.style.left = _tx;
_so.style.top = _ty;
}
}
function max(obj1,obj2,obj3){
var _so = document.getElementById(obj1);
var _sb = document.getElementById(obj2);
var _sw = document.body.clientWidth - 4 + "px";
var _sh = document.body.clientHeight - 32 + "px";
if(_so.style.width != _sw){
_cy = _so.style.top;
_cx = _so.style.left;
_sw_so = _so.style.width;
_sh_sb = _sb.style.height;
_so.style.top = "0px";
_so.style.left = "0px";
_so.style.width = _sw;
_sb.style.height = _sh;
obj3.innerHTML = "2";
}
else{
_so.style.width = _sw_so;
_sb.style.height = _sh_sb;
_so.style.top = _cy;
_so.style.left = _cx;
obj3.innerHTML = "1";
}
}
function cos(obj){
document.getElementById(obj).style.display = "none";
}
</script>
</body>
</html>[
本帖最后由 biyuan 于 2007-4-27 01:44 编辑 ]
论坛模式
推荐
收藏
分享给好友
推荐到圈子
管理
TAG: