Oto przykład z mojej postaci (tylko wejścia, które chcę, ale istnieje wiele innych):Get elementu przez część nazwy lub identyfikatora
<form name="inputform" action="..." method="post">
<input type="hidden" name="id_qtedje_77" id="id_qtedje_77" value="0">
<input type="text" id="id_qte_77" name="prestation_detail_fields[77][qte_collecte]" value="0.00">
<input type="text" id="id_rec_77" name="prestation_detail_fields[77][reliquat_conforme]" value="0.00">
<input type="text" id="id_ren_77" name="prestation_detail_fields[77][reliquat_non_conforme]" value="0.00">
<input type="checkbox" name="prestation_detail_fields[77][dechet_non_present]" value="1">
<!-- another TR -->
<input type="hidden" name="id_qtedje_108" id="id_qtedje_108" value="0">
<input type="text" id="id_qte_108" name="prestation_detail_fields[108][qte_collecte]" value="0.00">
<input type="text" id="id_rec_108" name="prestation_detail_fields[108][reliquat_conforme]" value="0.00">
<input type="text" id="id_ren_108" name="prestation_detail_fields[108][reliquat_non_conforme]" value="0.00">
<input type="checkbox" name="prestation_detail_fields[108][dechet_non_present]" value="1">
</form>
Co chcę jest uzyskanie wartości nakładów, ale ponieważ formularz jest zbudowany w PHP, nie znam identyfikatora linii (77, 108).
Czy istnieje sposób na zrobienie czegoś takiego jak getElementByName('id_qtedje_%')
?
Uwaga: Nie używam żadnej biblioteki i nie planuję jej używać.
http://stackoverflow.com/questions/4275071/javascript-getelementbyid-wildcard Ktoś zapytał już ... Nadzieja to pomaga;) –
Choć odpowiedź jest nieaktualne. –
@ Pye: Czy używasz dowolnej biblioteki? (jQuery, MooTools, Closure, Prototype ...) –