首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

网站后台遇到一个技术有关问题

2012-01-01 
网站后台遇到一个技术问题?我在做网站后台时,需要做一个下面这样的效果:分类管理(按钮)一级分类管理二级分

网站后台遇到一个技术问题?
我在做网站后台时,需要做一个下面这样的效果:

分类管理     (按钮)
        一级分类管理
        二级分类管理
        三级分类管理
        图书类别转移

当点击按钮时,下面的内容“一级分类管理,二。。。”,回收上去,应该是用JS实现的吧?谁那有代码,可以让我参考参考吗?谢过了。。




[解决办法]
用strutsmenu.jar
[解决办法]
<%@ page contentType= "text/html; charset=gb2312 " language= "java " errorPage= " " %>
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> 无标题文档 </title>
<script language= "javascript ">
var http_request = false;
var currentPos = null;
function send_request(url) {//初始化、指定处理函数、发送请求的函数
http_request = false;
//开始初始化XMLHttpRequest对象
if(window.XMLHttpRequest) { //Mozilla 浏览器
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {//设置MiME类别
http_request.overrideMimeType( 'text/xml ');
}
}
else if (window.ActiveXObject) { // IE浏览器
try {
http_request = new ActiveXObject( "Msxml2.XMLHTTP ");
} catch (e) {
try {
http_request = new ActiveXObject( "Microsoft.XMLHTTP ");
} catch (e) {}
}
}
if (!http_request) { // 异常,创建对象实例失败
window.alert( "不能创建XMLHttpRequest对象实例. ");
return false;
}
http_request.onreadystatechange = processRequest;
// 确定发送请求的方式和URL以及是否同步执行下段代码
http_request.open( "GET ", url, true);
http_request.send(null);
}
// 处理返回信息的函数
function processRequest() {
if (http_request.readyState == 4) { // 判断对象状态
if (http_request.status == 200) { // 信息已经成功返回,开始处理信息
//alert(http_request.responseText);
document.getElementById(currentPos).innerHTML = http_request.responseText;
} else { //页面不正常
alert( "您所请求的页面有异常。 ");
}
}
}
//显示部门下的岗位
function showRoles(obj) {
document.getElementById(obj).parentNode.style.display = " ";
document.getElementById(obj).innerHTML = "正在读取数据... "
currentPos = obj;
send_request( "sample2_2.jsp?playPos= "+obj);
}
</script>
<link href= "css/style.css " rel= "stylesheet " type= "text/css ">
</head>

<body>
<table width= "200 " border= "0 " cellspacing= "0 " cellpadding= "0 ">
<tr>
<td height= "20 "> <a href= "javascript:void(0) " onClick= "showRoles( 'pos_1 ') "> 经理室 </a> </td>
</tr>
<tr style= "display:none ">
<td height= "20 " id= "pos_1 "> &nbsp; </td>
</tr>
<tr>
<td height= "20 "> <a href= "javascript:void(0) " onClick= "showRoles( 'pos_2 ') "> 开发部 </a> </td>
</tr>
<tr style= "display:none ">
<td id= "pos_2 " height= "20 "> &nbsp; </td>
</tr>
</table>
<!--a href= "javascript:void(0) " onClick= "showRoles( 'pos_1 ') "> 测试 </a-->


<!--span style= "cursor: pointer; text-decoration: underline " onclick= "send_request( '2.jsp?username=educhina ') "> Send a request </span-->
</body>
</html>
[解决办法]
<html>
<head>
<title> </title>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">

</head>
<body>

<STYLE type= "text/css ">
A:link { COLOR: #000000; FONT-SIZE: 12px; TEXT-DECORATION: none}
A:visited { COLOR: #000000; FONT-SIZE: 12px; TEXT-DECORATION: none}
A:hover { COLOR: #006CD9; FONT-SIZE: 12px; TEXT-DECORATION: none}
BODY { FONT-SIZE: 12px;}
TD { FONT-SIZE: 12px; line-height: 150%}
</style>
<script language= "JavaScript ">
<!--
function showitem(id,name)
{
return ( " <span> <a href= ' "+id+ " ' target=_blank> "+name+ " </a> </span> <br> ")
}
function switchoutlookBar(number)
{
var i = outlookbar.opentitle;
outlookbar.opentitle=number;
var id1,id2,id1b,id2b
if (number!=i && outlooksmoothstat==0){
if (number!=-1)
{
if (i==-1){
id2= "blankdiv ";
id2b= "blankdiv ";
}
else{
id2= "outlookdiv "+i;
id2b= "outlookdivin "+i;
document.all( "outlooktitle "+i).style.border= "1px none navy ";
document.all( "outlooktitle "+i).style.background=outlookbar.maincolor;
document.all( "outlooktitle "+i).style.color= "#ffffff ";
document.all( "outlooktitle "+i).style.textalign= "center ";
}
id1= "outlookdiv "+number
id1b= "outlookdivin "+number
document.all( "outlooktitle "+number).style.border= "1px none white ";
document.all( "outlooktitle "+number).style.background=outlookbar.maincolor; //title
document.all( "outlooktitle "+number).style.color= "#ffffff ";
document.all( "outlooktitle "+number).style.textalign= "center ";
smoothout(id1,id2,id1b,id2b,0);
}
else
{
document.all( "blankdiv ").style.display= " ";
document.all( "blankdiv ").sryle.height= "100% ";
document.all( "outlookdiv "+i).style.display= "none ";
document.all( "outlookdiv "+i).style.height= "0% ";
document.all( "outlooktitle "+i).style.border= "1px none navy ";
document.all( "outlooktitle "+i).style.background=outlookbar.maincolor;
document.all( "outlooktitle "+i).style.color= "#ffffff ";
document.all( "outlooktitle "+i).style.textalign= "center ";
}
}
}
function smoothout(id1,id2,id1b,id2b,stat)
{
if(stat==0){
tempinnertext1=document.all(id1b).innerHTML;
tempinnertext2=document.all(id2b).innerHTML;
document.all(id1b).innerHTML= " ";
document.all(id2b).innerHTML= " ";
outlooksmoothstat=1;
document.all(id1b).style.overflow= "hidden ";
document.all(id2b).style.overflow= "hidden ";
document.all(id1).style.height= "0% ";
document.all(id1).style.display= " ";
setTimeout( "smoothout( ' "+id1+ " ', ' "+id2+ " ', ' "+id1b+ " ', ' "+id2b+ " ', "+outlookbar.inc+ ") ",outlookbar.timedalay);


}
else
{
stat+=outlookbar.inc;
if (stat> 100)
stat=100;
document.all(id1).style.height=stat+ "% ";
document.all(id2).style.height=(100-stat)+ "% ";
if (stat <100)
setTimeout( "smoothout( ' "+id1+ " ', ' "+id2+ " ', ' "+id1b+ " ', ' "+id2b+ " ', "+stat+ ") ",outlookbar.timedalay);
else
{
document.all(id1b).innerHTML=tempinnertext1;
document.all(id2b).innerHTML=tempinnertext2;
outlooksmoothstat=0;
document.all(id1b).style.overflow= "auto ";
document.all(id2).style.display= "none ";
}
}
}
function getOutLine()
{
outline= " <table "+outlookbar.otherclass+ "> ";
for (i=0;i <(outlookbar.titlelist.length);i++)
{
outline+= " <tr> <td name=outlooktitle "+i+ " id=outlooktitle "+i+ " ";
if (i!=outlookbar.opentitle)
outline+= " nowrap align=center style= 'cursor:hand;background-color: "+outlookbar.maincolor+ ";color:#ffffff;height:20;border:1 none navy ' ";
else
outline+= " nowrap align=center style= 'cursor:hand;background-color: "+outlookbar.maincolor+ ";color:white;height:20;border:1 none white ' ";
outline+=outlookbar.titlelist[i].otherclass
outline+= " onclick= 'switchoutlookBar( "+i+ ") '> <span class=smallFont> ";
outline+=outlookbar.titlelist[i].title+ " </span> </td> </tr> ";
outline+= " <tr> <td name=outlookdiv "+i+ " valign=top align=center id=outlookdiv "+i+ " style= 'width:100% "
if (i!=outlookbar.opentitle)
outline+= ";display:none;height:0%; ";
else
outline+= ";display:;height:100%; ";
outline+= " '> <div name=outlookdivin "+i+ " id=outlookdivin "+i+ " style= 'overflow:auto;width:100%;height:100% '> ";
for (j=0;j <outlookbar.itemlist[i].length;j++)
outline+=showitem(outlookbar.itemlist[i][j].key,outlookbar.itemlist[i][j].title);
outline+= " </div> </td> </tr> "
}
outline+= " </table> "
return outline
}
function show()
{
var outline;
outline= " <div id=outLookBarDiv name=outLookBarDiv style= 'width=100%;height:100% '> "
outline+=outlookbar.getOutLine();
outline+= " </div> "
document.write(outline);
}
function theitem(intitle,instate,inkey)
{
this.state=instate;
this.otherclass= " nowrap ";
this.key=inkey;
this.title=intitle;
}

[解决办法]
用梅花雪的树可以实现.

热点排行