Checkbox Abfrage mit VBScript

Hallo zusammen,
ich hab folgendes Problem mit VBScript:
Ich hab eine Seite die Input in eine dynamische Tabelle einträgt, welche wiederum input enthalten, unter anderem eine Checkbox.
Nun möchte ich Zeilen die mittels Checkbox Makiert wurden Löschen.
Leider ist die Checkbox, dadurch das sie Dynamisch erstellt wird nicht wirklich greifbar, auch der versuch eine <Form> um die Ursprungstabelle zu baun ist leider gescheitert, vielleicht hat ja jemand eine idee oder hat einen hinweis wo der Wurm steckt, ich steh leider grad aufm schlauch.

Vielen Dank schon mal
Greetz erik SN

HTML:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de-DE" lang="de-DE">
    <head>
        <title>TCS Update Tool</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="robots" content="follow" />
        <meta name="robots" content="index" />
        <meta name="revisit-after" content="20 days" />
        <meta http-equiv="pragma" content="no-cache" />
        <meta http-equiv="expires" content="0" />
        <meta http-equiv="cache-control" content="no-cache" />
        <!-- CSS DEFINITIONEN -->
        <link rel="stylesheet" href="_assets/css/import.css" type="text/css" />

        <!--[if IE]>
                <link href="_assets/css/ie.css" rel="stylesheet" type="text/css" />
                <![endif]-->

        <!--[if IE 6]>
                <link href="_assets/css/ie6.css" rel="stylesheet" type="text/css" />
                <![endif]-->

        <!--[if IE 7]>
                <link href="_assets/css/ie7.css" rel="stylesheet" type="text/css" />
        <![endif]-->
        <SCRIPT LANGUAGE="VBScript"> 
            count=2
            Sub doAddRow()
                Dim oTbl, oRow, oCell
                Set oTbl=document.getElementById("mytable")
                Set oRow = oTbl.insertRow 
                Set oCell = oRow.insertCell
                oCell.innerHTML= "<input name='User"&count&"' type='text' id='UserName"&count&"' value='"&TCS_UpdateFormular.User.Value&"' style='width:100%'/>"
                Set oCell = oRow.insertCell
                oCell.innerHTML= "<input name='Password"&count&"' type='text' id='Password"&count&"' value='"&TCS_UpdateFormular.Password.Value&"' style='width:100%'/>"
                Set oCell = oRow.insertCell
                oCell.innerHTML= "<input name='Pfad"&count&"' type='text' id='Pfad"&count&"' value='"&TCS_UpdateFormular.Pfad.Value&"' style='width:100%'/>"
                Set oCell = oRow.insertCell
                oCell.innerHTML= "<input name='IP"&count&"' type='text' id='IP"&count&"' value='"&TCS_UpdateFormular.IP.Value&"' style='width:100%'/>"
                Set oCell = oRow.insertCell
                oCell.innerHTML= "<input name='Check"&count&"' type='checkbox' id'check"&count&"' style='width:20px'/>"
                count = count+1
            End Sub 
            
            sub delete()
                Dim tmpCheckbox
                tmpcount = count
                Set oTbl=document.getElementById("mytable")
                
                for i = 1 to tmpcount
                tmpCheckbox = "Check"&i+1
                    If document.TCS_TableForm.tmpCheckbox.checked Then
                        msgbox(tmpCheckbox & "wird gelöscht")
                        oTbl.deleteRow(i)
                        tmpcount = tmpcount -1
                        i=i-1
                    End If
                Next    
            End Sub

        </SCRIPT>
               
    </head>
    <body>
        <div id="wrapper" class="container_12">
            <div id="container" class="clearfix">
                <div id="containerHead" class="clearfix">
                    <div id="slug" class="grid_4">
                        <img src="_assets/images/slug.gif" width="300" height="80" alt="TCS Update Tool" />
                    </div>
                    <div id="logo" class="grid_8">
                        <img src="_assets/images/_logo.jpg" alt="" />
                    </div>
                </div>
                <div id="contentWrapper" class="clearfix">
                    <div id="menu" class="grid_4">
                        <div class="innerWrapper">
                            <ul id="nav">
                                <li class="active"><a href="#">TCE Update Tool</a></li>
                                <li><a href="#">Nav 2</a></li>
                                <li><a href="#">Nav 3</a></li>
                                <li><a href="#">Nav 4</a></li>
                                <li><a href="#">Nav 5</a></li>
                                <li class="last"><a href="#">Nav 6</a></li>
                            </ul>
                        </div>
                    </div>
                    <div id="content" class="grid_8">
                        <div class="innerWrapper">
                            <div id="tcs_formWrapper">
                                <FORM NAME="TCS_UpdateFormular" ID="TCS_UpdateFormular" action="" method="post">
                                    <table id="tcs_inputTable">
                                        <tr>
                                            <td>
                                                <label for="User">Username</label>
                                                <INPUT NAME="User" TYPE="TEXT" />
                                            </td>
                                            <td>
                                                <label for="User">Passwort</label>
                                                <INPUT NAME="Password" type="password" />
                                            </td>
                                            <td>
                                                <label for="User">Pfad</label>
                                                <INPUT NAME="Pfad" TYPE="TEXT" />
                                            </td>
                                            <td>
                                                <label for="User">IP-Adresse</label>
                                                <INPUT NAME="IP" TYPE="TEXT" />
                                            </td>
                                        </tr>
                                    </table>
                                    <input type="Button" id="tcs_submit" value="Übernehmen" onclick="doAddRow()" />
                                </Form>
                            </div>
                            <div id="tcs_tableWrapper">
                            <FORM NAME="TCS_TableForm" ID="TCS_TableForm" method="post">
                                <table id="mytable" summary="Submitted table designs" style="width:100%">
                                    <caption>TCSen</caption>
                                    <thead>
                                        <tr>
                                            <th scope="col">UserName</th>
                                            <th scope="col">Passwort</th>
                                            <th scope="col">Pfad</th>
                                            <th scope="col">IP-Adresse</th>
                                            <th scope="col">Checkbox</th>
                                        </tr>
                                    </thead>
                                    <tbody>                                          
                                    </tbody>
                                </table>
                                </div>
                                <input type="Button" id="tcs_submit" value="Löschen" onclick="delete()"/>
                            </FORM>
                        </div>
                    </div>
                </div>
                <div id="footer"></div>
            </div>
        </div>
    </body>
</html>
 
Ich hab mal noch ein wenig herum Probiert und das Problem liegt anscheinend an dem Versuch den Namen bei der Abfrage Dynamisch zu erzeugen.
Kleines Bsp.
HTML:
sub delete()
 tmpUser="User"&count
 msgbox(TCS_TableForm.tmpUser.value)
End Sub
FUNKTIONIERT NICHT!
Wenn ich allerdings ein Festes Objekt nehme geht es!
HTML:
sub delete()
 msgbox(TCS_TableForm.User2.value)
End Sub
Jemand hierzu eine Idee wie man es trotzdem Dynamisch abfragen kann?!
 
hmm grad nochmal probiert.
also:
Code:
If document.getElementById("Check"&i).checked Then

Funktioniert auch, man muss also nicht unbedingt ne variable nehmen.

Abschließend lässt sich noch sagen, vbscript is wohl die furchtbarste Programmiersprache mit der ich mich je beschäftigt hab.:rolleyes:
 
hehe, das noch besser als Brainfuck oder whitespace ;)

aber mein Problem bei VBScript is eher das Schleifen grenzwerte überschreiten.
Und einfache Befehle wie document.getelementbyid("Check"&i).id für i=4 einfach mal trotzdem die Id von "Check3" ausgibt.
ohne wirklichen debuger macht einen dass auch wahnsinnig.
 
Weil ich ein Script brauch und sonst nichts auf dem PC installiert ist und auch nicht installiert werden soll, also hatte ich quasi keine alternative.
 
Zurück
Oben