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

📄 list_product.asp

📁 不错的ASP整站源代码。在IIS环境下运行都没有问题
💻 ASP
字号:
<!--#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
	keystr2 = "(p.CatalogID =" & selCatalog & ")"
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_product as p inner join ys_product_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>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table>
<table width="100%"  border="0" cellpadding="0" cellspacing="0" align="center"> 
<tr> 
  <td align="center"  valign=top> 
    <table width="90%" border="1" cellpadding="0" cellspacing="0" bordercolordark="#FFFFFF" bordercolorlight="#CCCCCC">
      <tr> 
        <td height="32" colspan="5" align="center" bgcolor="#225597"><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 cata_rs=server.createobject("adodb.recordset")  
							cata_sqlstr= "SELECT catalogID,CatalogName from ys_product_catalog where version='"&m_ver&"'"
							cata_rs.Open cata_sqlstr,conn
							do until cata_rs.EOF %>
                      <option value="<%=cata_rs("CatalogID")%>" <%=object_selected(selCatalog,cstr(cata_rs("CatalogID")))%>>⊙<%=cata_rs("catalogname")%></option>
                      <%
							cata_rs.MoveNext 
							loop
                            cata_rs.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="#336699"> 
          <td width="39" height="25" align="center">&nbsp;</td>
          <td width="379" height="25" align="center"><font color="#FFFFFF">产品名称</font></td>
          <td width="147" align="center"><font color="#FFFFFF">类别</font></td>
          <td width="109" align="center"><font color="#FFFFFF">是否促销</font></td>
          <td width="79" 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> 
          <td height="2" colspan="5" bgcolor="#CCCCCC" ></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 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" value=" 全 选 " onclick="javascript:select_change()"> 
            &nbsp;&nbsp; <input name="button_del" type="button" value=" 删 除 " onclick="javascript:del_to()"> 
            &nbsp;&nbsp;&nbsp; <input name="button_edit" type="button" 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>
      <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%>
    </table>
</body>
</html>

⌨️ 快捷键说明

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