注册 登录
编程论坛 ASP技术论坛

谁知道这段代码的作用.

故事人生 发布于 2010-04-02 20:35, 343 次点击
以下为代码片段,是一个添加产品的页面.这些代码在页面里就不能运行,不知是否缺少什么.
删除后就可以添加产品.但是不知有没有影响.
第一段代码,前头省略


<%
if Result="Modify" then
set rs = server.createobject("adodb.recordset")
sql="select * from LiangJingCMS_Products where ID="& ID
rs.open sql,conn,1,1
if rs.bof and rs.eof then
    response.write ("<center>数据库记录读取错误!</center>")
    response.end
end If
if rs("attribute1CH")<>"" and rs("attribute1CH_value")<>"" then
    attribute1CH_1=Split(rs("attribute1CH"),"§§§")
    attribute1CH_value_1=Split(rs("attribute1CH_value"),"§§§")
    Num_1=ubound(attribute1CH_1)+1
Else
    Num_1=0
End If
rs.close
set rs=Nothing
Else
    Num_1=0
End If
%>

第二段代码,中间省略


      Num_1=CheckStr(Request.Form("Num_1"),1)
      if Num_1="" then Num_1=0
      if Num_1>0 then
        For i=1 to Num_1
            If CheckStr(Request.Form("attributeCH"&i),0)<>"" and  CheckStr(Request.Form("attributeCH"&i&"_value"),0)<>"" Then
                If attribute1CH="" then
                    attribute1CH=CheckStr(Request.Form("attributeCH"&i),0)
                    attribute1CH_value=CheckStr(Request.Form("attributeCH"&i&"_value"),0)
                Else
                    attribute1CH=attribute1CH&"§§§"&CheckStr(Request.Form("attributeCH"&i),0)
                    attribute1CH_value=attribute1CH_value&"§§§"&CheckStr(Request.Form("attributeCH"&i&"_value"),0)
                End if
            End If
        Next

第三段代码,,中间省略
      rs("attribute1CH")=attribute1CH
      rs("attribute1CH_value")=attribute1CH_value
第四段代码,中间省略

      Num_1=CheckStr(Request.Form("Num_1"),1)
      if Num_1="" then Num_1=0
      if Num_1>0 then
        For i=1 to Num_1
            If CheckStr(Request.Form("attributeCH"&i),0)<>"" and  CheckStr(Request.Form("attributeCH"&i&"_value"),0)<>"" Then
                If attribute1CH="" then
                    attribute1CH=CheckStr(Request.Form("attributeCH"&i),0)
                    attribute1CH_value=CheckStr(Request.Form("attributeCH"&i&"_value"),0)
                Else
                    attribute1CH=attribute1CH&"§§§"&CheckStr(Request.Form("attributeCH"&i),0)
                    attribute1CH_value=attribute1CH_value&"§§§"&CheckStr(Request.Form("attributeCH"&i&"_value"),0)
                End if
            End If
        Next
      end if
第五段代码,中间省略
      rs("attribute1CH")=attribute1CH
      rs("attribute1CH_value")=attribute1CH_value

后面省略
2 回复
#2
yms1232010-04-03 12:53
if Num_1>0 then
这个End IF在哪?
#3
sn016152012-04-03 12:28
千博系统添加产品自定义属性的。
function num_1_1()
{
    var num_1=document.getElementById("Num_1").value;
    var num_1_str=document.getElementById("num_1_str");
    var str;
    str="<table width='100%' border='0' cellspacing='0' cellpadding='0'>";
    str=str+"<tr><td height='28'>";
    str=str+"属性名称:<input name='attributeCh"+(parseInt(num_1)+1)+"' type='text' id='attributeCh"+(parseInt(num_1)+1)+"' size='18' /> 属性值:<input name='attributeCh"+(parseInt(num_1)+1)+"_value' type='text' id='attributeCh"+(parseInt(num_1)+1)+"_value' size='50' /></td>";
    str=str+"</tr>";
    str=str+"</table>";
    num_1_str.innerHTML=num_1_str.innerHTML+str;
    document.getElementById("Num_1").value=(parseInt(num_1)+1);
}
amdin.js里有这样一段吧,哈哈
1