如何在这个基础上添加上移和下移功能<!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=utf-8" />
<title>无标题文档</title><script type="text/javascript">
//移入事件
var oldColor;
function overMethod(obj)
{
g=document.getElementById("p");
g.style.width=obj.offsetWidth;
//alert(obj.offsetWidth);
g.style.height=obj.offsetHeight-30;
g.style.left=obj.offsetLeft;
g.style.top=obj.offsetTop;
document.getElementById("p").style.display="block";
obj.cursor="pointer";
}
//移开事件
function outMethod(obj)
{
obj.style.backgroundColor = oldColor;
document.getElementById("p").style.display="none";
obj.style.cursor="default";
}
//漂浮层的打开和关闭
function over(obj)
{
document.getElementById(obj).style.display="block";
}
function out(obj)
{
document.getElementById(obj).style.display="none";
}
//删除层
function deleteDiv(obj)
{
var divTop=document.getElementById(obj)
var list=document.getElementById("parent").getElementsByTagName("div");
var left_list=document.getElementById("left_parentcount").getElementsByTagName("div");
//alert(left_list[0].id);
for(var i=0;i<list.length;i++)
{
for(var j=0;j<left_list.length;j++)
{
if(list[i].offsetTop==divTop.offsetTop && list[i].offsetWidth+6==divTop.offsetWidth )
{
document.getElementById(list[i].id).style.display="none";
document.getElementById(obj).style.display="none";
} if(left_list[j].offsetTop==divTop.offsetTop && left_list[j].offsetWidth+6==divTop.offsetWidth)
{
document.getElementById(left_list[j].id).style.display="none";
document.getElementById(obj).style.display="none";
}
}
}
}
//编辑层
function exit_div(obj)
{
}
function close_exit()
{
document.getElementById("exit_content").style.display="none";
}
//添加左边层
function addDiv(obj)
{
}
//右边添加的层
function rightDiv(obj)
{
}
//下移按下时
function upMaqqueDiv(obj)
{
}
function downUp(e)
{
e.releaseCapture();
}
</script><style type="text/css">
body
{
font-size:12px;
}
.showDiv
{
position:absolute;
background-color:#03C;
border:dashed #F93 3px;
display:none;
padding-top:8px;
filter:alpha(opacity=80);
}
.showDiv td
{
width:60px;
text-align:right;
padding-left:12px;
padding-bottom:12px;
margin-left:23px;
}
.backgrou
{
background-color:#AAD5D5;
height:23px;
}
.exitDiv
{
width:800px;
height:90px;
border-top:#F93 3px solid;
padding-top:8px;
padding-left:8px;
}
.exitDiv span
{
width:650px;
color:#F96;
height:23px;
text-align:right;
}
.exitDiv li
{
width:500;
height:23px;
background-color:#3CC;
}
.exit_d
{
border:9px solid #CCC;
width:550px;
height:auto;
display:none;
position:absolute;
top:300px;
left:300px;
z-index:1;
background-color:#EFEFEF;
}
a
{
background:#000;
color:#FFF;
}
a:hover
{
text-decoration:none;
}
.exit_d td
{
padding-left:28px;
padding-bottom:15px;
}
.exit_d span
{
width:150px;
font-size:12px;
}
.exit_d td h3
{
text-align:right;
width:400px;
height:23px;
}
.left_parent
{
float:left;width:auto;height:auto;claer:none;overflow:hidden;
}
.tb
{
border:#F90 1px solid;
}
.tb td
{
height:28px;
line-height:28px;
padding:5px;
}
.head
{
cellpadding:0px;
cellspacing:0px;
}
.head td
{
background:url(images/Button_sr.jpg);
width:74px;
height:26px;
border:0px;
line-height:21px;
padding:2px;
text-align:center;
color:#FFF;
}
.allhead
{
padding:12px;
}
.allDivbg
{
background-color:#3CF;
padding-top:8px;
filter:alpha(opacity=80);
text-align:center;
}
.head1 { cellpadding:0px;
cellspacing:0px;
}
.dBack {background-color: white;margin: 10px; filter:alpha(opacity=30); opacity: 0.3}
</style>
</head><body >
<!-- 编辑内容开始-->
<div id="exit_content" class="exit_d">
</div>
<!--编辑内结束 -->
<!--显示复盖层开始 -->
<div id="p" class="showDiv" onmouseover="over('p')" onmouseout="out('p')">
<table align="right">
<tr>
<td><a href="javascript:exit_div('p');">编辑</a></td>
<td><a href="">上移</a></td>
<td><a herf="#" onmousedown="upMaqqueDiv('p');" onmouseup="downUp(this);">下移</a></td>
<td><a href="javascript:deleteDiv('p');">删除</a></td>
</tr>
</table>
</div>
<!--显示复盖层结束 -->
<!--显示总层开始 -->
<div id="all" style="width:1015px;margin-left:180px;">
<!--显示头部开始-->
<div id="top" style="width:1015px; background:#FF9933;" class="allhead" onmouseover="overMethod(this)" onmouseout="outMethod(this)"> <table>
<tr>
<td width="48"><img src="images/nobody.gif" /></td>
<td>这里是店铺名称</td>
</tr>
<tr>
<td colspan="2"><table class="head1">
<tr>
<td>首页</td>
<td>信用评价</td>
<td>店铺介绍</td>
<td>交流区</td>
<td>友情热荐</td>
</tr>
</table></td>
</tr>
</table>
</div>
<div class="allDivbg"><input type="image" src="images/add.jpg" onclick="addDiv('left_parentcount');">在此处添加新模块</div>
<!--显示头部结束-->
<!--显示父层左边开始 -->
<div id="left_parentcount" class="left_parent">
<div id="test4" onmouseover="overMethod(this)" onmouseout="outMethod(this)">
<table border="0px" cellpadding="0" cellspacing="0" class="tb">
<tr>
<td colspan="2" bgcolor="#FF9933" style="color:#FFF;">搜索店内宝贝</td>
</tr>
<tr>
<td width="50" align="right">关键字</td>
<td ><input type="text" id="txtGuang" width="70" /></td>
</tr>
<tr>
<td align="right">价格</td>
<td width="65">
<input type="text" id="txtPrice" width="30" size="6"/>到<input type="text" id="txtPrice" width="30" size="6"/>
</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="button" value="搜索" /></td>
</tr>
</table>
</div>
<div id="test5" onmouseover="overMethod(this)" onmouseout="outMethod(this)">
<table border="0px" cellpadding="0" cellspacing="0" class="tb">
<tr>
<td colspan="2" bgcolor="#FF9933" style="color:#FFF;">宝贝排行榜</td>
</tr>
<tr>
<td width="100">本月热销排行</td>
<td width="105">热门热销排行</td>
</tr>
<tr>
<td colspan="2">查看本店其他宝贝</td>
</tr>
</table>
</div>
<div id="test6" onmouseover="overMethod(this)" onmouseout="outMethod(this)">
<table border="0px" cellpadding="0" cellspacing="0" class="tb">
<tr>
<td colspan="2" bgcolor="#FF9933" style="color:#FFF;">宝贝分类</td>
</tr>
<tr>
<td width="215">查看所有宝贝>></td>
</tr>
<tr>
<td>按销量 按新品 按价格 按收藏</td>
</tr>
</table>
</div>
<div id="test7" style="display:none;" onmouseover="overMethod(this)" onmouseout="outMethod(this)">
<table border="0px" cellpadding="0" cellspacing="0" class="tb">
<tr>
<td colspan="2" bgcolor="#FF9933" style="color:#FFF;">左边添加的层</td>
</tr>
</table>
</div>
<div class="allDivbg"><input type="image" src="images/add.jpg" onclick="addDiv('left_parentcount');">在此处添加新模块</div>
</div>
<!--显示父层左边父层结束 -->
<!--显示父层开始 -->
<div id="parent" style="float:right;width:780px; height:auto;claer:none;overflow:hidden;">
<!--显示子层内容开始 -->
<div id="test" class="exitDiv" onmouseover="overMethod(this)" onmouseout="outMethod(this)">热卖宝贝
<input type="button" value="所有宝贝" />
</div>
<div id="test1" class="exitDiv" onmouseover="overMethod(this)" onmouseout="outMethod(this)">
人气宝贝
<span><input type="button" value="所有宝贝" /></span>
</div>
<div id="test2" class="exitDiv" onmouseover="overMethod(this)" onmouseout="outMethod(this)">
店铺交流区
<span><input type="button" value="所有宝贝" /></span>
</div>
<div id="test3" class="exitDiv" onmouseover="overMethod(this)" onmouseout="outMethod(this)">
宝贝推广区
<span><input type="button" value="所有宝贝" /></span>
</div>
<div id="test8" class="exitDiv" style="display:none;" onmouseover="overMethod(this)" onmouseout="outMethod(this)">
右边添加的层
<span><input type="button" value="所有宝贝" /></span>
</div>
<!--显示子层内容结束 -->
<div class="allDivbg"><input type="image" src="images/add.jpg" onclick="rightDiv('parent');">在此处添加新模块</div>
</div>
<!--显示父层结束 -->
</div><!--显示总层结束 -->
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title><script type="text/javascript">
//移入事件
var oldColor;
function overMethod(obj)
{
g=document.getElementById("p");
g.style.width=obj.offsetWidth;
//alert(obj.offsetWidth);
g.style.height=obj.offsetHeight-30;
g.style.left=obj.offsetLeft;
g.style.top=obj.offsetTop;
document.getElementById("p").style.display="block";
obj.cursor="pointer";
}
//移开事件
function outMethod(obj)
{
obj.style.backgroundColor = oldColor;
document.getElementById("p").style.display="none";
obj.style.cursor="default";
}
//漂浮层的打开和关闭
function over(obj)
{
document.getElementById(obj).style.display="block";
}
function out(obj)
{
document.getElementById(obj).style.display="none";
}
//删除层
function deleteDiv(obj)
{
var divTop=document.getElementById(obj)
var list=document.getElementById("parent").getElementsByTagName("div");
var left_list=document.getElementById("left_parentcount").getElementsByTagName("div");
//alert(left_list[0].id);
for(var i=0;i<list.length;i++)
{
for(var j=0;j<left_list.length;j++)
{
if(list[i].offsetTop==divTop.offsetTop && list[i].offsetWidth+6==divTop.offsetWidth )
{
document.getElementById(list[i].id).style.display="none";
document.getElementById(obj).style.display="none";
} if(left_list[j].offsetTop==divTop.offsetTop && left_list[j].offsetWidth+6==divTop.offsetWidth)
{
document.getElementById(left_list[j].id).style.display="none";
document.getElementById(obj).style.display="none";
}
}
}
}
//编辑层
function exit_div(obj)
{
}
function close_exit()
{
document.getElementById("exit_content").style.display="none";
}
//添加左边层
function addDiv(obj)
{
}
//右边添加的层
function rightDiv(obj)
{
}
//下移按下时
function upMaqqueDiv(obj)
{
}
function downUp(e)
{
e.releaseCapture();
}
</script><style type="text/css">
body
{
font-size:12px;
}
.showDiv
{
position:absolute;
background-color:#03C;
border:dashed #F93 3px;
display:none;
padding-top:8px;
filter:alpha(opacity=80);
}
.showDiv td
{
width:60px;
text-align:right;
padding-left:12px;
padding-bottom:12px;
margin-left:23px;
}
.backgrou
{
background-color:#AAD5D5;
height:23px;
}
.exitDiv
{
width:800px;
height:90px;
border-top:#F93 3px solid;
padding-top:8px;
padding-left:8px;
}
.exitDiv span
{
width:650px;
color:#F96;
height:23px;
text-align:right;
}
.exitDiv li
{
width:500;
height:23px;
background-color:#3CC;
}
.exit_d
{
border:9px solid #CCC;
width:550px;
height:auto;
display:none;
position:absolute;
top:300px;
left:300px;
z-index:1;
background-color:#EFEFEF;
}
a
{
background:#000;
color:#FFF;
}
a:hover
{
text-decoration:none;
}
.exit_d td
{
padding-left:28px;
padding-bottom:15px;
}
.exit_d span
{
width:150px;
font-size:12px;
}
.exit_d td h3
{
text-align:right;
width:400px;
height:23px;
}
.left_parent
{
float:left;width:auto;height:auto;claer:none;overflow:hidden;
}
.tb
{
border:#F90 1px solid;
}
.tb td
{
height:28px;
line-height:28px;
padding:5px;
}
.head
{
cellpadding:0px;
cellspacing:0px;
}
.head td
{
background:url(images/Button_sr.jpg);
width:74px;
height:26px;
border:0px;
line-height:21px;
padding:2px;
text-align:center;
color:#FFF;
}
.allhead
{
padding:12px;
}
.allDivbg
{
background-color:#3CF;
padding-top:8px;
filter:alpha(opacity=80);
text-align:center;
}
.head1 { cellpadding:0px;
cellspacing:0px;
}
.dBack {background-color: white;margin: 10px; filter:alpha(opacity=30); opacity: 0.3}
</style>
</head><body >
<!-- 编辑内容开始-->
<div id="exit_content" class="exit_d">
</div>
<!--编辑内结束 -->
<!--显示复盖层开始 -->
<div id="p" class="showDiv" onmouseover="over('p')" onmouseout="out('p')">
<table align="right">
<tr>
<td><a href="javascript:exit_div('p');">编辑</a></td>
<td><a href="">上移</a></td>
<td><a herf="#" onmousedown="upMaqqueDiv('p');" onmouseup="downUp(this);">下移</a></td>
<td><a href="javascript:deleteDiv('p');">删除</a></td>
</tr>
</table>
</div>
<!--显示复盖层结束 -->
<!--显示总层开始 -->
<div id="all" style="width:1015px;margin-left:180px;">
<!--显示头部开始-->
<div id="top" style="width:1015px; background:#FF9933;" class="allhead" onmouseover="overMethod(this)" onmouseout="outMethod(this)"> <table>
<tr>
<td width="48"><img src="images/nobody.gif" /></td>
<td>这里是店铺名称</td>
</tr>
<tr>
<td colspan="2"><table class="head1">
<tr>
<td>首页</td>
<td>信用评价</td>
<td>店铺介绍</td>
<td>交流区</td>
<td>友情热荐</td>
</tr>
</table></td>
</tr>
</table>
</div>
<div class="allDivbg"><input type="image" src="images/add.jpg" onclick="addDiv('left_parentcount');">在此处添加新模块</div>
<!--显示头部结束-->
<!--显示父层左边开始 -->
<div id="left_parentcount" class="left_parent">
<div id="test4" onmouseover="overMethod(this)" onmouseout="outMethod(this)">
<table border="0px" cellpadding="0" cellspacing="0" class="tb">
<tr>
<td colspan="2" bgcolor="#FF9933" style="color:#FFF;">搜索店内宝贝</td>
</tr>
<tr>
<td width="50" align="right">关键字</td>
<td ><input type="text" id="txtGuang" width="70" /></td>
</tr>
<tr>
<td align="right">价格</td>
<td width="65">
<input type="text" id="txtPrice" width="30" size="6"/>到<input type="text" id="txtPrice" width="30" size="6"/>
</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="button" value="搜索" /></td>
</tr>
</table>
</div>
<div id="test5" onmouseover="overMethod(this)" onmouseout="outMethod(this)">
<table border="0px" cellpadding="0" cellspacing="0" class="tb">
<tr>
<td colspan="2" bgcolor="#FF9933" style="color:#FFF;">宝贝排行榜</td>
</tr>
<tr>
<td width="100">本月热销排行</td>
<td width="105">热门热销排行</td>
</tr>
<tr>
<td colspan="2">查看本店其他宝贝</td>
</tr>
</table>
</div>
<div id="test6" onmouseover="overMethod(this)" onmouseout="outMethod(this)">
<table border="0px" cellpadding="0" cellspacing="0" class="tb">
<tr>
<td colspan="2" bgcolor="#FF9933" style="color:#FFF;">宝贝分类</td>
</tr>
<tr>
<td width="215">查看所有宝贝>></td>
</tr>
<tr>
<td>按销量 按新品 按价格 按收藏</td>
</tr>
</table>
</div>
<div id="test7" style="display:none;" onmouseover="overMethod(this)" onmouseout="outMethod(this)">
<table border="0px" cellpadding="0" cellspacing="0" class="tb">
<tr>
<td colspan="2" bgcolor="#FF9933" style="color:#FFF;">左边添加的层</td>
</tr>
</table>
</div>
<div class="allDivbg"><input type="image" src="images/add.jpg" onclick="addDiv('left_parentcount');">在此处添加新模块</div>
</div>
<!--显示父层左边父层结束 -->
<!--显示父层开始 -->
<div id="parent" style="float:right;width:780px; height:auto;claer:none;overflow:hidden;">
<!--显示子层内容开始 -->
<div id="test" class="exitDiv" onmouseover="overMethod(this)" onmouseout="outMethod(this)">热卖宝贝
<input type="button" value="所有宝贝" />
</div>
<div id="test1" class="exitDiv" onmouseover="overMethod(this)" onmouseout="outMethod(this)">
人气宝贝
<span><input type="button" value="所有宝贝" /></span>
</div>
<div id="test2" class="exitDiv" onmouseover="overMethod(this)" onmouseout="outMethod(this)">
店铺交流区
<span><input type="button" value="所有宝贝" /></span>
</div>
<div id="test3" class="exitDiv" onmouseover="overMethod(this)" onmouseout="outMethod(this)">
宝贝推广区
<span><input type="button" value="所有宝贝" /></span>
</div>
<div id="test8" class="exitDiv" style="display:none;" onmouseover="overMethod(this)" onmouseout="outMethod(this)">
右边添加的层
<span><input type="button" value="所有宝贝" /></span>
</div>
<!--显示子层内容结束 -->
<div class="allDivbg"><input type="image" src="images/add.jpg" onclick="rightDiv('parent');">在此处添加新模块</div>
</div>
<!--显示父层结束 -->
</div><!--显示总层结束 -->
</body>
</html>
解决方案 »
- asp文本框限制
- JavaScript源码分析 高手群(84507704) 欢迎加入!!研究Js面向对象 jQuery Extjs
- 一个级联菜单的问题
- 想写一个通用的 JS 拖曳类,请帮帮忙
- JS load XML 问题
- 关于.focus()的一个问题
- 求助,如何使得页面上所有的文本输入框变成只读?
- 有没有人做过自动成批将®© 转换成®,©?
- jQuery动态添加表格时,发现标签丢失的情况,具体代码如下
- javascript如何得到文件的绝对路径?(在线等,急)
- ie中的id火狐没用
- 关于网站流量统计,基本都是new image?需要传送的数据。。。谁知道后台对这个图片是怎么处理的啊?
好好看看这个个性化页面的源码吧
http://www.google.com/ig?hl=zh-cn