按什么来排序?不过想要获取标签名可以使用document.getElementsByTagName()方法。

解决方案 »

  1.   

    用户设定有进行存储吗?如果有,后台处理就方便多了。前台的话,那不如直接让USER自己去移动好了。我记得有个代码是写如何控制操作行的。我这有,不过代码才多了,贴上来麻烦你要的话,我可以发MAIL给你。
      

  2.   

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
    <%
    Sub DrawTable()
        Dim arrTitle(4)
        Dim arrRecords(2, 4)
        
        Dim strIndex(4)
        Dim intIndex(4)
        Dim strChecked(4)
        Dim i
        Dim j
        Dim temp
        
        arrTitle(0) = "业务日期"
        arrTitle(1) = "单据编号"
        arrTitle(2) = "商业客户"
        arrTitle(3) = "营销板块"
        arrTitle(4) = "业务员"
        
        arrRecords(0, 0) = "日期1"
        arrRecords(0, 1) = "编号1"
        arrRecords(0, 2) = "客户1"
        arrRecords(0, 3) = "板块1"
        arrRecords(0, 4) = "业务员1"
        
        arrRecords(1, 0) = "日期2"
        arrRecords(1, 1) = "编号2"
        arrRecords(1, 2) = "客户2"
        arrRecords(1, 3) = "板块2"
        arrRecords(1, 4) = "业务员2"
        
        arrRecords(2, 0) = "日期3"
        arrRecords(2, 1) = "编号3"
        arrRecords(2, 2) = "客户3"
        arrRecords(2, 3) = "板块3"
        arrRecords(2, 4) = "业务员3"
            
        strIndex(0) = request.Form("textfield1")
        strIndex(1) = request.Form("textfield2")
        strIndex(2) = request.Form("textfield3")
        strIndex(3) = request.Form("textfield4")
        strIndex(4) = request.Form("textfield5")
        
        strChecked(0) = request.Form("checkbox1")
        strChecked(1) = request.Form("checkbox2")
        strChecked(2) = request.Form("checkbox3")
        strChecked(3) = request.Form("checkbox4")
        strChecked(4) = request.Form("checkbox5")
        
        intIndex(0) = 0
        intIndex(1) = 1
        intIndex(2) = 2
        intIndex(3) = 3
        intIndex(4) = 4
        
        For i = 0 To 3
            For j = i + 1 To 4
                If strIndex(i) > strIndex(j) Then
                    temp = strIndex(i)
                    strIndex(i) = strIndex(j)
                    strIndex(j) = temp
                    
                    temp = intIndex(i)
                    intIndex(i) = intIndex(j)
                    intIndex(j) = temp
                End If
            Next
        Next
        Response.Write ("<table border='1' align='center'>")
        Response.Write ("<tr>")
        For j = 0 To 4
            If strChecked(j) = "1" Then
                Response.Write ("<td>" & arrTitle(intIndex(j)) & "</td>")
            End If
        Next
        Response.Write ("</tr>")
        For i = 0 To 2
            Response.Write ("<tr>")
    For j = 0 To 4
                If strChecked(j) = "1" Then
                    Response.Write ("<td>" & arrRecords(i,intIndex(j)) & "</td>")
                End If
            Next
    Response.Write ("</tr>")
        Next
        Response.Write ("</table>")
    End Sub
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title></title>
    </head><body>
    <form name="form1" action="<%= request.ServerVariables("SCRIPT_NAME") %>" method="post">
      <table width="300" border="1" align="center">
        <tr> 
        <td>字段</td>
        <td>显示</td>
          <td>列显示顺序</td>
      </tr>
      <tr> 
          <td>业务日期</td>
        <td><input type="checkbox" name="checkbox1" value="1" <% if request("checkbox1")="1" then response.Write(" checked ")%>></td>
        <td><input type="text" name="textfield1" value="<%=request.Form("textfield1")%>"></td>
      </tr>
      <tr> 
          <td>单据编号</td>
        <td><input type="checkbox" name="checkbox2" value="1" <% if request("checkbox2")="1" then response.Write(" checked ")%>></td>
        <td><input type="text" name="textfield2"  value="<%=request.Form("textfield2")%>"></td>
      </tr>
      <tr> 
          <td>商业客户</td>
        <td><input type="checkbox" name="checkbox3" value="1" <% if request("checkbox3")="1" then response.Write(" checked ")%>></td>
        <td><input type="text" name="textfield3"  value="<%=request.Form("textfield3")%>"></td>
      </tr>
      <tr> 
          <td>营销板块</td>
        <td><input type="checkbox" name="checkbox4" value="1" <% if request("checkbox4")="1" then response.Write(" checked ")%>></td>
        <td><input type="text" name="textfield4"  value="<%=request.Form("textfield4")%>"></td>
      </tr>
      <tr>
          <td>业务员</td>
        <td><input type="checkbox" name="checkbox5" value="1" <% if request("checkbox5")="1" then response.Write(" checked ")%>></td>
        <td><input type="text" name="textfield5"  value="<%=request.Form("textfield5")%>"></td>
      </tr>
    </table>
      <div align="center"><input type="submit" name="Submit" value="提交"></div>
    </form>
    <br><br>
    <% Call DrawTable %>
    </body>
    </html>
      

  3.   

    在这个地址可以看代码效果
    http://211.90.237.18/zhujh/help.asp
      

  4.   

    另外说明,排序关键字使用的是Acscii比较,而不是用数字,所以支持字母。但也有个缺点,就是10会比2小,这个你自己取舍一下。
      

  5.   

    多谢楼上的几位啦。前后顺序是存储在数据库中的。样子和 rawjim的演示的很像,只不过下面是datagrid。