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

📄 list_product.asp

📁 不错的ASP整站源代码。在IIS环境下运行都没有问题
💻 ASP
字号:
<%@language="VBscript"%>
<!--#include file="../checkuser.asp" -->
<%
 m_ver = Trim(request("ver"))
 if m_ver="cn" then 
  tmpstr_t="[中文版]"
 elseif  m_ver="en"  then 
 tmpstr_t="[英文版]"
 else
 response.write "错误访问页面,请重试" 
 response.end    
 End If%> 
<!--#include file="../../include/db_conn.asp" -->
<!--#include file="../../include/pub_func.asp" -->  
<!--#include file="include/const.asp" --> 
<%
KeyWord = Request.Form("KeyWord")
selField = Request.Form("selField")
selCatalog = Request.Form("selCatalog")
''关键字检索条件
if KeyWord <> "" then
	if selField = "0" then
		keystr1= "(p.ProductName LIKE '%" & KeyWord & "%' OR p.Content LIKE '%" & KeyWord & "%')"
	elseif selField = "1" then
		keystr1 = "(p.ProductName LIKE '%" & KeyWord & "%')"
	elseif selFIeld = "2" then
		keystr1= "(p.Content LIKE '%" & KeyWord & "%')"
	end if
else
	keystr1= ""
end if
''类别检索条件
if selCatalog <> "" then
    set tmp_rs =conn.execute("SELECT * FROM ys_product2_Catalog WHERE parentID="&selCatalog)
	if not tmp_rs.eof then
	keystr2 = "(p.CatalogID in (select catalogid from ys_product2_catalog where  parentid=" & selCatalog & "))"
	else
	keystr2 = "(p.CatalogID="&selcatalog&")"
	end if 
else
	keystr2 = ""
end if

''组合查询条件
wherestr0=" where p.version='"&m_ver&"'"
if keystr1 <> "" and keystr2 <> "" then
	wherestr =wherestr0&" and " &keystr1& " AND " &keystr2 & " "
elseif keystr1 <> "" and keystr2 = "" then
	wherestr = wherestr0&" and " & keystr1 & " "
elseif keystr1 = "" and keystr2 <> "" then
	wherestr = wherestr0&" and " & keystr2 & " "
else
	wherestr = wherestr0&" "
end if

''组合查询SQL语句 

sqlstr = "select p.*,c.catalogname from ys_product2 as p inner join ys_product2_catalog as c on p.catalogid=c.catalogid "
sqlstr =sqlstr & wherestr
sqlstr =sqlstr & " ORDER BY p.orderid,p.updatedate desc,p.id desc"


%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>产品维护</title>
<script language=Javascript>
  function select_change(){
      if(document.frm_list.button_select.value==" 全 选 "){            
          document.frm_list.button_select.value=" 取 消 ";
          select_All(true);           
          }
      else{
          document.frm_list.button_select.value=" 全 选 ";
          select_All(false);          
          }       
  }
  
  function select_All(checked){
          
      for (var i=0;i<document.frm_list.elements.length;i++){
		var e = document.frm_list.elements[i];
		//alert(e.name);
		if (e.name != 'allbox')
		    e.checked = checked;
		    
      }
  }       
  function count_checked_items() {
    var number_checked=0;
	var box_count=document.frm_list.productlist.length;
	if ( box_count==null ) {
	   
		if ( document.frm_list.productlist.checked==true ) {
			number_checked=1;
		}else {
			number_checked=0;
		}
	}else {
		for ( var i=0; i < (box_count); i++ ) {
		if ( document.frm_list.productlist[i].checked==true ) {
			number_checked++;
			}
		}
	 }
	 return number_checked;
  }
  
      
  function del_to() {
      if (count_checked_items()>0){           
          if(confirm("您真的要删除这些产品吗?")){           
          document.frm_list.action="action_ok.asp";
          document.frm_list.hidAction.value="DEL";
          document.frm_list.submit();
          }
      }
      else
          alert('请您先选择要删除的产品!');
          return false;       
      }

  function add_to_edit() {
      if (count_checked_items()>0){                           
          document.frm_list.action="edit_product.asp";
          document.frm_list.hidAction.value="EDIT";
          document.frm_list.submit();         
      }
      else
          alert('请您先选择要修改的产品!');
          return false;       
      }
 

</script>
<link href="../include/styles.css" rel="stylesheet" type="text/css">
</head>
   
<table width="90%"  border="0" cellpadding="0" cellspacing="0" align="center">
  <tr>  
    <td>
	<table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolordark="#FFFFFF" bordercolorlight="#cccccc">
        <tr bgcolor="#225597"> 
          <td height="25" colspan="5" align="center"><font color="#FFFFFF">产品维护<%=tmpstr_t%></font></td>
        </tr>
        <tr> 
          <td height="25" colspan="5" align="center"> <table width="100%" border="0" cellpadding="0" cellspacing="0">
              <form action="list_product.asp" method="post" name="frm_Search">
                <tr> 
                  <td height="25" colspan="3"><div align="center">输入关键字: 
                      <input name="KeyWord" type="text" class="Input" size="16" value="<%=KeyWord%>">
                      <select name="selField" class="Input">
                        <option value="0" <%=isSelected("0",selField)%>>--选择--</option>
                        <option value="1" <%=isSelected("1",selField)%>>产品名称</option>
                        <option value="2" <%=isSelected("2",selField)%>>产品说明</option>
                      </select>
                      <select name="selCatalog" class="Input">
                        <option value="">--选择--</option>
                        <%  
							set catalog_rs1=server.createobject("adodb.recordset")  
							catalog_sqlstr1= "SELECT catalogID,CatalogName from ys_product2_catalog where catalogid=parentid and version='"&m_ver&"'"
							catalog_rs1.Open catalog_sqlstr1,conn
							do until catalog_rs1.EOF %>
                        <option value="<%=catalog_rs1("CatalogID")%>"  <%=object_selected(cstr(selCatalog),cstr(catalog_rs1("CatalogID")))%>>⊙<%=catalog_rs1("catalogname")%></option>
                        <% set catalog_rs2=server.createobject("adodb.recordset")  
							    catalog_sqlstr2= "SELECT catalogID,CatalogName from ys_product2_catalog where catalogid<>parentid and parentid="&catalog_rs1("catalogid")&" and version='"&m_ver&"'"
							    catalog_rs2.Open catalog_sqlstr2,conn
							    do until catalog_rs2.EOF 
								%>
                        <option value="<%=catalog_rs2("CatalogID")%>"    <%=object_selected(cstr(selCatalog),cstr(catalog_rs2("CatalogID")))%>>┠—<%=catalog_rs2("catalogname")%></option>
                        <% catalog_rs2.MoveNext 
							    loop
							catalog_rs1.MoveNext 
							loop
                            catalog_rs2.Close 
							catalog_rs1.Close 
                            %>
                      </select>
                      <input name="seach" type="submit" class="Input" id="seach" value=" 查 询 ">
                      <input name="ver" type="hidden" class="Input"  value="<%=m_ver%>">
                    </div></td>
                </tr>
              </form>
            </table></td>
        </tr>
        <form action="#" method="POST" name="frm_list">
          <tr bgcolor="#225597"> 
            <td width="38" height="25" align="center">&nbsp;</td>
            <td width="373" height="25" align="center"><font color="#FFFFFF">产品名称</font></td>
            <td width="145" align="center"><font color="#FFFFFF">类 别</font></td>
            <td width="107" align="center"><font color="#FFFFFF">是否促销</font></td>
            <td width="75" align="center"><font color="#FFFFFF">排序号</font></td>
          </tr>
          <%
			set myrs=server.createobject("adodb.recordset")
		 	myrs.Open sqlstr,conn,1,1
			if myrs.RecordCount>0 then          
            myrs.PageSize=p_pagesize    '每页显示的记录数  '显示标题时               
            total_page=myrs.PageCount
            total_red=myrs.RecordCount
            current_page=Request("m_page")
                  
            if current_page="" then
                current_page=1
            elseif not isnumeric(current_page) then
                current_page=1
            else
                current_page=cint(current_page)
            end if

            if current_page>total_page then
                current_page=total_page
            elseif current_page<1 then
                current_page=1
            end if
                  
            myrs.AbsolutePage=current_page         
           
				for i = 1 to p_pagesize%>
          <tr <%if i mod 2 =0 then%>bgcolor="#F0f0f0"<%end if%>> 
            <td height="25" align="center"><input type="checkbox" name="productlist" value="<%=myrs.Fields("ID")%>"></td>
            <td align="center"><a href="view_product.asp?pid=<%=myrs.Fields("ID")%>" target=_new><%=myrs.Fields("ProductName")%></a></td>
            <td align="center"><%=myrs("catalogname")%></td>
            <td align="center"><font color="#FF0000">
              <%if myrs.Fields("ifhot")="1" then Response.Write "√"  %>
              </font></td>
            <td align="center"><%=myrs.Fields("orderid")%></td>
          </tr>
          <%
					myrs.MoveNext 
					If myrs.EOF Then Exit For
					next
				end if
			myrs.Close 		  
			%>
          <tr bgcolor="#CCCCCC">
            <td height="2" colspan="5" ></td>
          </tr>
          <%if total_page>1 then%>
          <tr> 
            <td height="44" align="right" bgcolor="#FFFFFF" colspan="5"><strong>分页显示: 
              </strong> <%call showpage%>
              &nbsp;&nbsp;<%=current_page%>/<%=total_page%> 转到第 
              <input name="goto_page1" type="text" class="Input" value=<%=current_page%> size="2" maxlength=3>
              <input style="height:19;WIDTH: 30px;border-left:1 ridge #ffffff;border-top:1 ridge #ffffff;border-bottom:1;border-right:1;border-style:ridge;background-color:#cccccc;"
          hideFocus type="button" value="Go" name="cmd_goto" onClick="javascript:viewPage(document.all.goto_page1.value);"></td>
            <!--#include file="include/showpage.asp"-->
          </tr>
          <%end if%>
          <tr> 
            <td height="25" align="center" bgcolor="#FFFFFF" colspan="5"> <input name="button_select" type="button" class="Input" value=" 全 选 " onclick="javascript:select_change()"> 
              &nbsp;&nbsp; <input name="button_del" type="button" class="Input" value=" 删 除 " onclick="javascript:del_to()">
              &nbsp;&nbsp;&nbsp; <input name="button_edit" type="button" class="Input" value=" 修 改 " onclick="javascript:add_to_edit()">
              &nbsp;&nbsp;&nbsp; </td>
          </tr>
          <tr>
            <td colspan="5"> </td>
          </tr>
          <input type="hidden" name="KeyWord" value=<%=KeyWord%>>
          <input type="hidden" name="selField" value=<%=selField%>>
          <input type="hidden" name="selCatalog" value=<%=selCatalog%>>
          <input type="hidden" name="hidAction" value="edit">
          <input type="hidden" name="ver" value="<%=m_ver%>">
        </form>
      </table>   
      </td>
     </tr>    
 </table>

 <form name="frm_page" action="list_product.asp" method=post >
 <input type="hidden" name="ver" value="<%=m_ver%>">
  <input type="hidden" name="KeyWord" value=<%=KeyWord%>>
  <input type="hidden" name="selField" value=<%=selField%>>
  <input type="hidden" name="selCatalog" value=<%=selCatalog%>>
 <input type="hidden" name="m_page">
</form>

<%call closedb%>

⌨️ 快捷键说明

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