se me ocurre esto para ti:
Código PHP:
<script language="javascript">
function GetComodines() {
var inputs = document.getElementsByTagName("input");
for (i=0; i < inputs.length; i++) {
if (inputs[i].type == "text") {
if (inputs[i].name.substring(0, 6) == "precio") {
alert(inputs[i].value);
}
}
}
}
window.onload = function() {
GetComodines();
}
</script>
Código HTML:
<input type="text" name="precio1" id="precio1" value="1">
<input type="text" name="precio2" id="precio2" value="2">
<input type="text" name="precio3" id="precio3" value="3">
<input type="text" name="precio4" id="precio4" value="4">
<input type="text" name="precio5" id="precio5" value="5">
saludos