⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ct_catalog.jsp

📁 很好的JSP带码 有好东西大家共同分享 适合想学JSP网站建设的同志。
💻 JSP
📖 第 1 页 / 共 2 页
字号:
		if(char1.charAt(n)!=char2.charAt(n)){
			if(mode) return(charSet.indexOf(char1.charAt(n))>charSet.indexOf(char2.charAt(n))?1:-1);
			else	 return(charSet.indexOf(char1.charAt(n))<charSet.indexOf(char2.charAt(n))?1:-1);
			break;
		}
	}
	return(0);
}

function sort_tab(the_tab,col,mode){
	var tab_arr = new Array();
	var i;
	var start=new Date;
	for(i=1;i<the_tab.rows.length;i++){
		tab_arr.push(new Array(the_tab.rows[i].cells[col].innerText.toLowerCase(),the_tab.rows[i]));
	}
	function SortArr(mode) {
		return function (arr1, arr2){
			var flag;
			var a,b;
			a = arr1[0];
			b = arr2[0];
			if(/^(\+|-)?\d+($|\.\d+$)/.test(a) && /^(\+|-)?\d+($|\.\d+$)/.test(b)){
				a=eval(a);
				b=eval(b);
				flag=mode?(a>b?1:(a<b?-1:0)):(a<b?1:(a>b?-1:0));
			}else{
				a=a.toString();
				b=b.toString();
				if(a.charCodeAt(0)>=19968 && b.charCodeAt(0)>=19968){
					flag = judge_CN(a,b,mode);
				}else{
					flag=mode?(a>b?1:(a<b?-1:0)):(a<b?1:(a>b?-1:0));
				}
			}
			return flag;
		};
	}
	tab_arr.sort(SortArr(mode));

	for(i=0;i<tab_arr.length;i++){
		the_tab.lastChild.appendChild(tab_arr[i][1]);
	}

	window.status = " (Time spent: " + (new Date - start) + "ms)";
}

function change_row(the_tab,line1,line2){
	the_tab.rows[line1].swapNode(the_tab.rows[line2])
}

function change_col(the_tab,line1,line2){
	for(var i=0;i<the_tab.rows.length;i++)
		the_tab.rows[i].cells[line1].swapNode(the_tab.rows[i].cells[line2]);
}

function Move_up(the_table){
	event.cancelBubble=true;
	if(cur_row==null || cur_row<=1)return;
	change_row(the_table,cur_row,--cur_row);
}

function Move_down(the_table){
	event.cancelBubble=true;
	if(cur_row==null || cur_row==the_table.rows.length-1 || cur_row==0)return;
	change_row(the_table,cur_row,++cur_row);
}

function Move_left(the_table){
	event.cancelBubble=true;
	if(cur_col==null || cur_col==0)return;
	change_col(the_table,cur_col,--cur_col);
	if(cur_col==sort_col)sort_col=cur_col+1;
	else if(cur_col+1==sort_col)sort_col=cur_col;
}

function Move_right(the_table){
	event.cancelBubble=true;
	if(cur_col==null || cur_col==the_table.rows[0].cells.length-1)return;
	change_col(the_table,cur_col,++cur_col);
	if(cur_col==sort_col)sort_col=cur_col-1;
	else if(cur_col-1==sort_col)sort_col=cur_col;
}

function add_row(the_table) {
	event.cancelBubble=true;
	var the_row,the_cell;
	the_row = cur_row==null?-1:(cur_row+1);
	clear_color();
	var newrow=the_table.insertRow(the_row);
	for (var i=0;i<the_table.rows[0].cells.length;i++) {
		the_cell=newrow.insertCell(i);
		the_cell.innerText="NewRow_" + the_cell.parentElement.rowIndex;
	}
	read_def(the_table);
}

function del_row(the_table) {
	if(the_table.rows.length==1) return;
	var the_row;
	the_row = (cur_row==null || cur_row==0)?-1:cur_row;
	the_table.deleteRow(the_row);
	cur_row = null;
	cur_cell=null;
}

function add_col(the_table) {
	event.cancelBubble=true;
	var the_col,i,the_cell;
	the_col = cur_col==null?-1:(cur_col+1);
	var the_title=prompt("Please input the title: ","Untitled");
	if(the_title==null)return;
	if(the_col!=-1 && the_col<=sort_col && sort_col!=null)sort_col++;
	the_title=the_title==""?"Untitled":the_title
	clear_color();
	for(var i=0;i<the_table.rows.length;i++){
		the_cell=the_table.rows[i].insertCell(the_col);
		the_cell.innerText=i==0?the_title:("NewCol_" + the_cell.cellIndex);
	}
	read_def(the_table);
}

function del_col(the_table) {
	if(the_table.rows[0].cells.length==1) return;
	var the_col,the_cell;
	the_col = cur_col==null?(the_table.rows[0].cells.length-1):cur_col;
	if(the_col!=-1 && the_col<sort_col && sort_col!=null)sort_col--;
	else if(the_col==sort_col)sort_col=null;
	for(var i=0;i<the_table.rows.length;i++) the_table.rows[i].deleteCell(the_col);
	cur_col = null;
	cur_cell=null;
}

function res_tab(the_table){
	the_table.outerHTML=Org_con;
	init();
}

function exp_tab(the_table){
	var the_content="";
	document.onclick();
	the_content=the_table.outerHTML;
	the_content=the_content.replace(/ style=\"[^\"]*\"/g,"");
	the_content=the_content.replace(/ mode=\"(false|true)"/g,"");
	the_content=the_content.replace(/ oBgc=\"[\w#\d]*\"/g,"");
	the_content=the_content.replace(/ oFc=\"[\w#\d]*\"/g,"");
	the_content=the_content.replace(/<DIV contentEditable=false>([^<]*)<\/DIV>/ig,"$1");
	the_content="<style>table{font-size: 9pt;word-break:break-all;cursor: default;BORDER: black 1px solid;background-color:#eeeecc;border-collapse:collapse;border-Color:#999999;align:center;}</style>\n"+the_content;
	var newwin=window.open("about:blank","_blank","");
	newwin.document.open();
	newwin.document.write(the_content);
	newwin.document.close();
	newwin=null;
}

function addSon(parentid)
{
	document.temp_form.action = "add_catalog.jsp";
	document.temp_form.backurl.value = "<%=StringUtil.getCurrentURL(request)%>";
	document.temp_form.parentid.value = parentid;
	document.temp_form.submit();
}

function modC(id)
{
	document.temp_form.action = "mod_catalog.jsp";
	document.temp_form.backurl.value = "<%=StringUtil.getCurrentURL(request)%>";
	document.temp_form.id.value = id;
	document.temp_form.submit();
}

function delC(id)
{
	if (confirm("确认操作吗?"))
	{
		document.temp_form.action = "<%=ConfigBean.getStringValue("systenFolder")%>appController/delCatalog";
		document.temp_form.id.value = id;
		document.temp_form.submit();
	}
}

function selectColor(index)
{
	var result = window.showModalDialog('color_panel_if.jsp',window,"dialogWidth:20;dialogHeight:20;status:no;help:no");

	if ( !(typeof result == 'undefined') )
	{
		document.getElementById("preColor"+index).style.background = result;
	}
}

function boldTitle(thebox)
{
	if ( thebox.checked )
	{
		document.csort_form.action = "<%=ConfigBean.getStringValue("systenFolder")%>appController/boldTitle";
	}
	else
	{
		document.csort_form.action = "<%=ConfigBean.getStringValue("systenFolder")%>appController/unBoldTitle";
	}
	
	document.csort_form.id.value = thebox.value;
	document.csort_form.submit();
}

function colorTitle(id,index)
{
	document.csort_form.action = "<%=ConfigBean.getStringValue("systenFolder")%>appController/colorTitle";
	document.csort_form.id.value = id;
	document.csort_form.color.value = document.getElementById("preColor"+index).style.background;
	document.csort_form.submit();
}
</script>
<style type="text/css">
<!--
.line-black-1234 {
	border: 1px solid #000000;
}
-->
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<br>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td bgcolor="#FFFFFF"> <TABLE width=100% height="47" border=0 cellPadding=0 cellSpacing=0   class="thetable" id="PowerTable">
        <form name="csort_form" method="post">
          <input type="hidden" name="id">
          <input type="hidden" name="color">
          <thead>
            <TR align=middle> 
              <TD width="8%" height="22" align="center">货架编号</TD>
              <TD align="left">货架名称</TD>
            </TR>
          </thead>
          <%
String lineBg;
DBRow catalog[] = catalogMgr.getCatalogByParentId(0l,null);
for ( int i=0; i<catalog.length; i++ )
{
		if ( i%2==0 )
		{
			lineBg = "#ffffff";
		}
		else
		{
			lineBg = "#eeeeee";
		}
%>
          <TR> 
            <TD height="23" align="center" bgcolor="<%=lineBg%>"> 
              <%=catalog[i].getString("id")%>
            </TD>
            <TD width="92%" bgcolor="<%=lineBg%>"> <span style="<%=catalog[i].getString("title_style")%>"> 
              <%=catalog[i].getString("title")%>
              </span> </TD>
          </TR>
          <%
}
%>
        </form>
      </TABLE>
      <table width="100%" border="0" cellspacing="0" cellpadding="5">
        <tr> 
          <td><input name="button" type=button id=move    onclick=Move_up(Main_Tab) value= 上移 > 
            <input name="button" type=button id=move  onclick=Move_down(Main_Tab) value= 下移 > 
            <input type="button" name="Submit3" value="保存修改" onClick="updateCatalogSort(Main_Tab)"></td>
        </tr>
      </table></td>
  </tr>
</table>
<br>
<form action="" method="get" name="temp_form">
<input type="hidden" name="id">
<input type="hidden" name="parentid">
<input type="hidden" name="backurl">
</form>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0"  class="thetable">
  <form name="listForm" method="post">
    <input type="hidden" name="id">
    <input type="hidden" name="parentid">
    <input type="hidden" name="imp_color">
    <thead>
      <tr> 
        <td valign="middle">货架名称</td>
        <td valign="middle">&nbsp;</td>
        <td valign="middle">连 接</td>
        <td align="center" valign="middle">加 亮</td>
        <td align="center" valign="middle">货架编号</td>
        <td width="6%" align="center" valign="middle">访问数</td>
        <td width="7%" align="center" valign="middle">商品数量</td>
        <td width="21%" align="center" valign="middle">操 作</td>
      </tr>
    </thead>
    <tr bgcolor="cccccc"> 
      <td valign="middle" >商 城</td>
      <td valign="middle" >&nbsp;</td>
      <td valign="middle" >&nbsp;</td>
      <td width="7%" align="center" valign="middle">/</td>
      <td width="8%" align="center" valign="middle" >/</td>
      <td align="center" valign="middle">/</td>
      <td align="center" valign="middle" >/ </td>
      <td align="center" valign="middle"> <input type="button" name="Submit" value="增加子货架" onClick="addSon(0)"> 
      </td>
    </tr>
    <%
String qx;
int kk=0;
DBRow treeRows[] = catalogMgr.getCatalogTree();
for ( int i=0; i<treeRows.length; i++ )
{
	if ( treeRows[i].get("parentid",0)!=0&&treeRows[i].get("parentid",0)!=expandID )
	{
		continue;
	}
	
		if ( kk++%2==0 )
		{
			lineBg = "#ffffff";
		}
		else
		{
			lineBg = "#eeeeee";
		}
		
	if ( treeRows[i].get("parentid",0) != 0 )
	 {
	 	qx = "├ ";
	 }
	 else
	 {
	 	qx = "";
	 }
%>
    <tr onMouseOut="this.style.background='<%=lineBg%>'"onMouseOver="this.style.background='#F4E088'" bgcolor="<%=lineBg%>"> 
      <td width="17%" height="60" valign="middle"> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; 
        <%=Tree.makeSpace("&nbsp;&nbsp;&nbsp;",treeRows[i].get("level",0))%>
        <%=qx%>
        <%=treeRows[i].get("level",0)==1?"<img src='../../imgs/expand_tag.gif'> ":""%> <a class="blue" href="?expandID=<%=treeRows[i].getString("id")%>"><%=treeRows[i].getString("title")%></a>
      </td>
      <td width="8%" align="center" valign="middle">
<%
if ( !treeRows[i].getString("img").equals("") )
{
%>
	  <a href="<%=ConfigBean.getStringValue("systenFolder")%>.<%=ConfigBean.getStringValue("upload_pro_img")+treeRows[i].getString("img")%>" target="_blank"><img src="<%=ConfigBean.getStringValue("systenFolder")%>.<%=ConfigBean.getStringValue("upload_pro_img")+treeRows[i].getString("img")%>" width="50" height="50" border="0" alt="<%=treeRows[i].getString("description")%>"></a>
<%
}
%>	  
	  </td>
      <td width="26%" valign="middle"><a href="<%=treeRows[i].getString("link")%>" target="_blank"> 
        <%=treeRows[i].getString("link")%>
        </a></td>
      <td width="7%" align="center" valign="middle"> 
        <%
String alive_sl;
if ( treeRows[i].get("imp_color",0) == 1 )
{
	alive_sl = "checked";
}
else
{
	alive_sl = "";
}

if ( treeRows[i].get("level",0)>1 )
{
%>
        <input type="checkbox" name="alive_x" id="alive_x" value="<%=treeRows[i].getString("id")%>" onClick="impColor(this)" <%=alive_sl%>> 
<%
}
%>
      </td>
      <td width="8%" align="center" valign="middle"> 
        <%=treeRows[i].getString("id")%>
      </td>
      <td align="center" valign="middle"> 
        <%=treeRows[i].getString("click")%>
      </td>
      <td align="center" valign="middle"> 
        <%=productMgr.getNewProductByCid(treeRows[i].get("id",0l),null).length%>
      </td>
      <td align="center" valign="middle"> <input type="button" name="Submit2s" value="删除" onClick="delC(<%=treeRows[i].getString("id")%>)"> 
        <input type="button" name="Submit2" value="修改" onClick="modC(<%=treeRows[i].getString("id")%>)"> 
        <input type="button" name="Submit22" value="增加子货架" onClick="addSon(<%=treeRows[i].getString("id")%>)"></td>
    </tr>
    <%	
}
%>
  </form>
</table>
<br>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -