佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 796|回复: 3

关于 java script table 的 check box。

[复制链接]
发表于 24-11-2005 09:52 PM | 显示全部楼层 |阅读模式
如果我写一个可以generate 一个 table 的 function inside this table i can insert the data to database table.我已能 generate table 但 是我 table 里 面的check box 我要checked 的时后是 paid ,unchecked is paid 然后 store 这些info 在database 我 应该怎么做?请帮帮忙我已试了很多方但是不能
回复

使用道具 举报


ADVERTISEMENT

发表于 24-11-2005 10:19 PM | 显示全部楼层
你试了什么方法? 为什么不能? 你用什么 language/平台?
回复

使用道具 举报

 楼主| 发表于 25-11-2005 08:28 AM | 显示全部楼层
我已式用了以下这个方法 但是有error说
Request object error 'ASP 0105 : 80004005'

Index out of range

/project/uploadOEM.asp, line 13

An array index is out of range.


我的coding is :

<%
Dim strUserTxt, iInputs, iLoop,updRS1,PartNo,sql2,productNo,action,subop,updRS2
Dim edit,remarks,iIn,iLoop1,p,k
action = request.Querystring("operation")
subop = request.Form("subop")
iInputs = Request.Form("ProductNum1").Count

iIn = Request.Form("edit1").Count
response.write iIn
if action = "update"  and subop="update" then

For iLoop = 1 To iInputs
Response.Write Request.Form("ProductNum1")(iLoop)
Response.write Request.Form("Description1")(iLoop)
Response.write Request.Form("edit1")(iLoop)
productNo = Request.Form("ProductNum1")

Next



end if
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Insert/Delete Table Row using DOM</title>
<SCRIPT LANGUAGE="JavaScript">
function testButton (form){
iIn = form.edit1.Count
for (Count = 0; Count < iIn; Count++) {
if (form.edit1[Count].checked)
break;
}
alert ("Button " + Count + " is selected");
}
</SCRIPT>



<script language="javascript">
var gRowId = 2;

function delRow(button)
{
var row = button.parentNode.parentNode;
var tbody = document.getElementById('table1').getElementsByTagName('tbody')[0];
tbody.removeChild(row);
}

function addRow()
{
var tbody = document.getElementById('table1').getElementsByTagName('tbody')[0];

var row = document.createElement('TR');
var cell9 = document.createElement('TD');
var cell1 = document.createElement('TD');
var cell2 = document.createElement('TD');
var cell3 = document.createElement('TD');


var inp8 = document.createElement('INPUT');
var inp1 = document.createElement('INPUT');
var inp2 = document.createElement('INPUT');
var inp3 = document.createElement('INPUT');
var inp4 = document.createElement('INPUT');
var inp5 = document.createElement('INPUT');
var inp6 = document.createElement('INPUT');
var inp7 = document.createElement('INPUT');
var inp10 = document.createElement('INPUT');

inp8.setAttribute('type','checkbox');
inp8.setAttribute('name','edit1');
inp8.setAttribute('onClick','0');
inp1.setAttribute('type','text');
inp1.setAttribute('name','ProductNum1');
inp1.setAttribute('size','20');

inp2.setAttribute('type','text');
inp2.setAttribute('name','Description1');
inp2.setAttribute('size','30');


cell1.innerHTML = "";
cell9.appendChild(inp8);
cell2.appendChild(inp1);
cell3.appendChild(inp2);



row.appendChild(cell1);
row.appendChild(cell9);
row.appendChild(cell2);
row.appendChild(cell3);


tbody.appendChild(row);

gRowId++;
}

function shownames(){
var allInp=document.getElementsByTagName('input');
for(var i=0;i<allInp.length;i++){
alert(allInp[i].name)
}
}

// To select all the rows (checkboxes) in the filter criteria table.
function selectAll(){
var n = document.getElementById("table1").getElementsByTagName("TR");
if (document.AddForm.editChange.checked == true){
for (var i = 0; i < n.length; i++){
n[i].getElementsByTagName("INPUT")[0].checked = true;
}
}else if(document.AddForm.editChange.checked == false){
for (var j = 0; j < n.length; j++){
n[j].getElementsByTagName("INPUT")[0].checked = false;
}
}
}




</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>OEM</title>
</head>


<body>

<tr>
        <td height="60">
                <table border=0 width="100%">
                        <tr>
                                <td width=220>&nbsp;</td>
                                <td width="80">
                                <img border="0" src="image/agilent_logo.jpg" width="80" height="65"></td>
                                <td><b><font face="Verdana" size="4">Quote Work Book</font></b></td>
                        </tr>
                </table></td>
</tr>
<tr><td><hr></td></tr>

<table width="" height="20" border="0">
                   <tr>
                        <td width="700" align="left"><font face="Arial" size="3"><b>OEM</b></font></td>
               
                </tr>
                <tr>
                        <td colspan = '3'><font face = 'Arial'></font></td>
                </tr>
<form action="1.asp?operation=update" method="POST" name="AddForm">

                <tr>
                        <td colspan = '3' align = 'center'>
                                <table border = '0' width = '1100'></table>
                        </td>
                </tr>
                <tr>
                        <td colspan = '3' align = 'left'>
                                <table border = '0' width = '1100'><tr><td><a href="index.asp">&nbsp;Main&nbsp;</a> | <a href="insert.asp?prodid=<%=session("proid")%>">&nbsp;Input&nbsp;</a> |<a href="uploadVAMAT(Del).asp?prodid=<%=session("proid")%>">&nbsp;Va_Mat(Del)&nbsp;</a>|<a href="uploadVAFAC.asp?prodid=<%=session("proid")%>">Va_Fac</a> | <a href="risk.asp">Risk</a> | <a href="UploadAtHw.asp?prodid=<%=session("proid")%>">At_Hw</a> </td></tr></table>
                        </td>
                </tr>

        <br>

                <tr>
                        <td colspan = '3' align = 'left'>
                        <table width = '334' border = '0'>
                                <tr>

                                        <td align = 'center' width = '87' ><input type="button" value="Insert Row" onClick="addRow();"></td>
                       
                                        <td align = 'center' width = '118'>
                                        <INPUT TYPE="button" NAME="button" Value="Click"
onClick="testButton(this.form)"></td>
       
                                       
               
                                </tr>

                                </table>
       
       
                    <p><input type="text" name="text1" size="20"></p>
        <INPUT TYPE="radio" NAME="rad" Value="rad_button1" onClick=0><BR>
<INPUT TYPE="radio" NAME="rad" Value="rad_button2" onClick=0><BR>
<INPUT TYPE="radio" NAME="rad" Value="rad_button3" onClick=0><BR>

       
            <table border="1" id="table1" width='1000'>
                                <tr>
                                        <td align = 'center' width = '8' bgcolor="#D0E1FD">&nbsp;</td>
                                        <td align = 'center' width = '55' bgcolor="#D0E1FD"><font size='2' face="Arial"><b>Remarks </b><input type="checkbox" name="editChange" value="ON"  onClick="selectAll();"></td>
                                        <td align = 'center' width = '200' bgcolor="#D0E1FD"><font size='2' face="Arial"><b>Product Number</b></font></td>
                                        <td align = 'center' width = '100' bgcolor="#D0E1FD"><font size='2' face="Arial"><b>Descriptions</b></font></td>
                                        <td align = 'center' width = '150' bgcolor="#D0E1FD"><font size='2' face="Arial"><b>Vendor</b></font></td>
                                       
                                        <td align = 'center' width = '100' bgcolor="#D0E1FD"><font size='2' face="Arial"><b>Ship For FAC OR FIC</b></font></td>
                                        <td align = 'center' width = '100' bgcolor="#D0E1FD"><font size='2' face="Arial"><b>Quantity</b></font></td>
                                        <td align = 'center' width = '150' bgcolor="#D0E1FD"><font size='2' face="Arial"><b>Weeks LT</b></font></td>
                                        <td align = 'center' width = '300' bgcolor="#D0E1FD"><font size='2' face="Arial"><b>Unit Cost&nbsp; (US Dollar)&nbsp;&nbsp;</td>
                                        <td align = 'center' width = '300' bgcolor="#D0E1FD">&nbsp;</td>
                                </tr>
                                               

                                        <tr>
                                        <td></td>
                                        <td>
                                        <input type="checkbox" name="edit1" onClick=0></td>
                                        <td>
                                        <input type = 'text' name = 'ProductNum1' size="20" readonly>
                                        </td>
                                        <td><input type = 'text' value = '' name = 'Description1' size="30" readonly></td>
                    <td ><input type = 'text' value = '' name = 'Vendor1' size="15" readonly>
                    </td>
                  
                    <td><input type = 'text' value = '' name = 'FicToFac1' size="20">
                    </td>
                    <td><input type = 'text' name = 'Qty1' size="5">
                   </td>
                                        <td> <input type = 'text' name = 'LT1' size="12">
                                        </td>
                                        <td><input type = 'text' value = '' name = 'ListPrice1' size="20" readonly></td>
                                        <td>&nbsp;</td>
                                                                </tr>
       
                                </table>
                        </td>
                </tr>
                <br>
                <tr>
                        <td><input type="hidden" name="subop">
&nbsp;<input type="button" value="Update" language="VBScript" onClick=SubmitAdd("update")>&nbsp;&nbsp;&nbsp;
                        <input type = 'button' name = 'Ocancel' value = 'Cancel'></td>
                </tr>
                </form>
                    <tr>
                              <td colspan="3">
                                  <table height="10" width="110%" bgcolor="#00699C">
                                      <tbody>
                                    <tr><td> </td>
                                </tr>
                                      </tbody>
                    </table>
                              </td>
                    </tr>
                         </table>

</body>

</html>
<SCRIPT language="VBScript">
<!--

Sub EditClicked(linkID)
  with Document.SearchForm
    .searchID.value = linkID
    .submit
  end with
end sub

Sub SubmitAdd(operation)
  With Document.AddForm
      .subop.value = operation

      if operation = "delete" then
        If Msgbox("You are about to delete the selected link permanently. Are you sure?", vbYesNo, "Delete?") = vbYes then
          .submit
        end if
      else
        .submit
      end if
  end with
end sub

Sub AddChange()
  With Document.AddForm
    .submit
  end with
end sub

Sub SearchChange(resetEdit)
  With Document.SearchForm
    if resetEdit = 1 then
      .schap.value = ""
    end if
    .submit
  end with
end sub

-->
</SCRIPT>
回复

使用道具 举报

发表于 25-11-2005 07:15 PM | 显示全部楼层
看得我头昏眼花, 如果我没记错的话, 你应该不能那样写:

Response.Write Request.Form("ProductNum1")(iLoop)

Request.Form("ProductNum1") 传回来的资料应该是 "result1, result2, resul3...", 不是 array.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 21-9-2024 02:46 PM , Processed in 0.124224 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表