`

JS 可以把DIV排序

阅读更多
<!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>
<style>
.shijuanxiti_2_case{
margin:auto;
padding:4px;
height:24px;
}
.shijuanxiti_2_d_t{
float:left;
width:70%;
}
.shijuanxiti_2_d_m{
float:left;
width:10%;
text-align:center;
cursor:pointer;
}
.shijuanxiti_2_d_d{
float:left;
width:10%;
text-align:center;
cursor:pointer;
}
.shijuanxiti_test{
float:left;
padding:0 4px;
width:300px;
*width:292px;
_width:292px;
height:24px;
}
.shijuanxiti_test input{
padding:2px 4px;
width:290px;
*width:282px;
_width:282px;
height:17px;/* height:17px; @edom2009-06-09 */
border:1px solid #6EAFD9;
background-color:#FFF;
}
.shijuanxiti_page{
margin:auto;
width:97%;
background-image:url(../skin/table_line_bg.gif);
background-position:top;
background-repeat:repeat-x;
background-color:#F4F4F4;
border:1px solid #D7D7D7;
height:33px;
}
.shijuanxiti_page_case{
margin:auto;
padding:4px 0 0 0;
width:450px;
}
.shijuanxiti_page_f{
float:left;
padding:0 4px;
color:#949494;
}
.shijuanxiti_page_f span{
padding:0 4px;
color:#949494;
}
.shijuanxiti_page_f span a {
font-size: 12px;
color: #949494;
}
.shijuanxiti_page_f span a:link {
text-decoration: none;
}
.shijuanxiti_page_f span a:visited {
text-decoration: none;
color: #949494;
}
.shijuanxiti_page_f span a:hover {
text-decoration: underline;
color: #2B2B2B;
}
.shijuanxiti_page_f span a:active {
text-decoration: none;
color: #949494;
}
.shijuanxiti_page_c{
float:left;
padding:0 4px;
}
.shijuanxiti_page_spage{
float:left;
margin:0 4px;
width:22px;
height:22px;
border:1px solid #D7D7D7;
text-align:center;
background-color:#949494;
color:#FFF;
font-weight:bold;
_display:inline;
}
.shijuanxiti_page_spage a{
font-size:12px;
color:#FFF;
}
.shijuanxiti_page_spage a:link {
text-decoration: none;
}
.shijuanxiti_page_spage a:visited {
text-decoration: none;
color: #FFF;
}
.shijuanxiti_page_spage a:hover {
text-decoration: underline;
color: #2B2B2B;
}
.shijuanxiti_page_spage a:active {
text-decoration: none;
color: #FFF;
}
.shijuanxiti_page_hpage{
float:left;
margin:0 4px;
width:22px;
height:22px;
border:1px solid #949494;
text-align:center;
background-color:#FFF;
color:#949494;
font-weight:bold;
_display:inline;
}
.shijuanxiti_page_hpage a {
font-size: 12px;
color: #949494;
}
.shijuanxiti_page_hpage a:link {
text-decoration: none;
}
.shijuanxiti_page_hpage a:visited {
text-decoration: none;
color: #949494;
}
.shijuanxiti_page_hpage a:hover {
text-decoration: underline;
color: #2B2B2B;
}
.shijuanxiti_page_hpage a:active {
text-decoration: none;
color: #949494;
}
.shijuanxiti_4_case{
margin:auto;
width:97%;
background-image:url(../skin/table_line_bg.gif);
background-position:top;
background-repeat:repeat-x;
border-top:1px solid #D7D7D7;
border-left:1px solid #D7D7D7;
border-right:1px solid #D7D7D7;
overflow:hidden;
}
.shijuanxiti_4_t_g{
float:left;
width:50%;
height:25px;
line-height:25px;
text-align:center;
font-weight:bold;
letter-spacing:2px;
color:#2B2B2B;
overflow:hidden;
}
.shijuanxiti_4_t_p{
float:left;
width:10%;
height:25px;
line-height:25px;
text-align:center;
font-weight:bold;
letter-spacing:2px;
color:#2B2B2B;
overflow:hidden;
}
.shijuanxiti_4_t_r{
float:left;
width:40%;
height:25px;
line-height:25px;
text-align:center;
font-weight:bold;
letter-spacing:2px;
color:#2B2B2B;
overflow:hidden;
}
.shijuanxiti_4_c{
height:26px;
line-height:26px;
overflow:hidden;
}
.shijuanxiti_4_d_g{
float:left;
width:50%;
height:25px;
line-height:25px;
text-align:center;
color:#2B2B2B;
border-bottom:1px solid #D7D7D7;
}
.shijuanxiti_4_d_p{
float:left;
width:10%;
height:25px;
line-height:25px;
text-align:center;
color:#2B2B2B;
border-bottom:1px solid #D7D7D7;
}
.shijuanxiti_4_d_r{
float:left;
width:40%;
height:25px;
line-height:25px;
text-align:center;
color:#2B2B2B;
border-bottom:1px solid #D7D7D7;
}
.shijuanxiti_4_d_r input{
margin:0 4px;
padding:1px 2px;
width:40px;
height:16px;
border:1px solid #D7D7D7;
font-family:Tahoma;
font-size:12px;
color:#949494;
}
.shijuanxiti_4test{
float:left;
padding:0 4px;
width:60px;
*width:52px;
_width:52px;
height:24px;
}
.shijuanxiti_4test input{
padding:2px 4px;
width:50px;
*width:42px;
_width:42px;
height:17px;/* height:17px; @edom2009-06-09 */
border:1px solid #6EAFD9;
}
.shijuanxiti_conn_4{
float:right;
width:80px;
height:30px;
}
.shijuanxiti_5_test{
float:left;
padding:0 4px;
height:24px;
line-height:24px;
}
.shijuanxiti_5_test span{
padding:0 4px;
color:#975525;
font-weight:bold;
}
.shijuanxiti_5_title{
float:left;
padding:0 4px;
height:24px;
line-height:24px;
color:#949494;
}
.shijuanxiti_5_s_box{
float:left;
width:200px;
}
.shijuanxiti_5_s_erro{
float:left;
width:60px;
}
.shijuanxiti_conn_5{
float:right;
width:240px;
height:30px;
}
.shijuanxiti_5_form_con{
float:left;
padding:0 4px;
width:110px;
height:28px;/* height:28px; @edom 2009-06-09 */
}
.shijuanxiti_5_form_con input{
padding:0 0 0 0px;
*padding:2px 0 0 0;
_padding:2px 0 0 0;
width:100px;
height:24px;
*height:24px;
_height:20px;
cursor:pointer;
border-left:4px solid #6EAFD9;
border-right:1px solid #6EAFD9;
border-bottom:1px solid #6EAFD9;
border-top:1px solid #6EAFD9;
background-color:#FFF;
letter-spacing:4px;
}
</style>
</head>
<body>
<div class="common_front shijuanxiti_2_case" id="shijuanxiti_2_case_1">
<div class="common_front shijuanxiti_2_d_t">选择题</div>
<div class="common_front shijuanxiti_2_d_m" onclick="divAct(this,'up')">上移</div>
<div class="common_front shijuanxiti_2_d_m" onclick="divAct(this,'down')">下移</div>
<div class="common_front shijuanxiti_2_d_d" onclick="divAct(this,'delete')">删除</div>
<div class="debug_erro"></div>
</div>
<div class="erro_07"></div>
<div class="common_front shijuanxiti_2_case" id="shijuanxiti_2_case_2">
<div class="common_front shijuanxiti_2_d_t">填空题</div>
<div class="common_front shijuanxiti_2_d_m" onclick="divAct(this,'up')">上移</div>
<div class="common_front shijuanxiti_2_d_m" onclick="divAct(this,'down')">下移</div>
<div class="common_front shijuanxiti_2_d_d" onclick="divAct(this,'delete')">删除</div>
<div class="debug_erro"></div>
</div>
<div class="erro_07"></div>
<div class="common_front shijuanxiti_2_case" id="shijuanxiti_2_case_3">
<div class="common_front shijuanxiti_2_d_t">翻译题</div>
<div class="common_front shijuanxiti_2_d_m" onclick="divAct(this,'up')">上移</div>
<div class="common_front shijuanxiti_2_d_m" onclick="divAct(this,'down')">下移</div>
<div class="common_front shijuanxiti_2_d_d" onclick="divAct(this,'delete')">删除</div>
<div class="debug_erro"></div>
</div>
<script language="javascript">
function divAct(newobj,acttype)
{
var p=newobj.parentNode;
var pp=newobj.parentNode.parentNode;
switch(acttype)
{
case "up":
if(p.id==pp.firstChild.id){window.alert("首位不能上移");}//end else
else{
pp.insertBefore(p,p.previousSibling);
}
break;
case "down":
if(p.id==pp.lastChild.id){window.alert("末位不能下移");}//end else
else{
pp.insertBefore(p.nextSibling,p);
}
break;
case "delete":
pp.removeChild(p);
break;
default:
window.alert("error");
}
}
</script>
</body>
</html>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics