Announcement

Collapse
No announcement yet.

JS submit buttons without form

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • JS submit buttons without form

    Hi.

    Benötige gerade dass erste Mal js und weiß nicht wie ich bei untenstehender Tabelle die jeweilige ID herausbekomme ?. Wie macht man dass mit Javasript , damit ich die zugehörige Zeile des jeweiligen Submit Buttons bekomme ?

    bin für jede hilfe dankbar

    lg

    reinhardl


    <SCRIPT type="text/javascript" language="javascript">
    function deleteEntry(svnr)
    {


    self.location.href='addressBook.do?id=svnr';

    }

    </SCRIPT>
    </head>
    <body>



    <!-- note how bare numbers or numbers with quotes -->


    <table border="1">
    <tr>
    <th>
    ID
    </th>
    <th>
    FIRSTNAME
    </th>
    <th>
    LASTNAME
    </th>
    <th>
    EMAIL
    </th>
    </tr>
    <c:forEach var="contact" items="${requestScope.contactList}">
    <tr>
    <td>
    <cut value="${contact.id}"/>

    </td>
    <td>
    ${contact.firstName}
    </td>
    <td>
    ${contact.lastName}
    </td>
    <td>
    ${contact.email}
    </td>
    <td>
    <input type="button" value="Zur&uuml;cksetzen" onclick="deleteEntry(this.ID)">
    </td>
    </tr>
    </c:forEach>
    </table>

  • #2
    Mit this.id bekommst du wenn nur den Wert von dem input type.
    Aber dem hast du ja noch nicht mals eine Id zugeteilt. Also geht das nicht.


    Du willst die Id von der Tabelle rausbekommen versteh ich das richtig oder?

    Comment

    Working...
    X