日期:2014-05-17  浏览次数:20821 次

instr函数及new Arrany
最近分没了,这是暂了二天的分,大家见谅

如果这是一个删除函数
那么在提交页里面的instr函数的这个逗号是始终都不会有的吧
如果我要删N项,这里有一个函数调用的

function   Cheall(form)
{
for(var   i=0;i <form.elements.length;i++)
    {
        var   e=form.elements[i];
        if(e.name!= "cheall ")
        e.checked=form.cheall.checked;
    }
}

<td> <input   name= "id "   type= "checkbox "   value= " <%=rs( "id ")%> "> </td>
下面是处理页的一个函数判断
if   instr(id, ", ")> 0   then       //这个逗号应该不会有的吧提交的时候怎么会有逗号的呢


------------------------------------------------------

subcat   =   new   Array();                     //这是定义的几维数组,一,二??
                <%
                count   =   0
                do   while   not   rs.eof  
                %>
subcat[ <%=count%> ]   =   new   Array( " <%=   trim(rs( "SmallClassName "))%> ", " <%=   trim(rs( "BigClassName "))%> ", " <%=   trim(rs( "SmallClassName "))%> ");   //这里是一维吗????


if   (subcat[i][1]   ==   locationid)     //这个是二维吗???
那上面的定义是几维呢?

------解决方案--------------------
表单有个这样的特性,如果标签的 name值相同,那么就会以逗号隔开,例如checkbox,你把他们都改成相同的name,那么他发送时就是:
checkbox1的value, checkbox2的value, checkbox3的value, ...
这样


new Array(); //这里定义了一个数组
subcat[ <%=count%> ] = new Array( " <%= trim(rs( "SmallClassName "))%> ", " <%= trim(rs( "BigClassName "))%> ", " <%= trim(rs( "SmallClassName "))%> "); //这里把刚才哪个数组的每个元素指向一个数组,和二维数组是一样的