Buenas, pasa que he creado una tabla con campos de formulario y con los valores de estos quiero llenar otro, lo que quiero es "sumar" los values para crear una cadena direccion(geografica) y enviarla a la base de datos. Tengo la funcion ya hecha pero no se ejecuta me gustaria su colaboracion con este lio.
Código Javascript
:
Ver original<script>
function dirprop(){
var dir = document.getElementById ("dirprop").value;
var tipvia = document.getElementById ("dirprop_tipovia").value;
var numvia = document.getElementById ("dirprop_numvia").value;
var apevia = document.getElementById ("dirprop_apevia").value;
var orivia = document.getElementById ("dirprop_orivia").value;
var numcrz = document.getElementById ("dirprop_numcruce").value;
var apecrz = document.getElementById ("dirprop_apecruce").value;
var oricrz = document.getElementById ("dirprop_oricruce").value;
var numplaca = document.getElementById ("dirprop_numplaca").value;
var comp = document.getElementById ("dirprop_complemento").value;
dir = tipvia + ' ' +numvia;
if(trim(apevia)!=''){
dir = dir + apevia;
}
if(trim(orivia)!=''){
dir = dir + ' ' + orivia;
}
if(trim(numcrz)!=''){
dir = dir + ' # ' + numcrz;
}
if(trim(apecrz)!=''){
dir = dir + apecrz;
}
if(trim(oricrz)!=''){
dir = dir + ' ' + oricrz;
}
if (trim(numplaca)!='') {
dir = dir + ' ' + numplaca;
}
if (trim(comp)!='') {
dir = dir + ' ' + comp;
}
document.getElementById("dirprop").value = dir;
}
</script>
Código HTML:
Ver original<table align="center" width="95%"> <td width="25%" align="right"> <b>DIRECCI
ÓN PROPIETARIO
</b></td> <td width="75%" align="left"> <input type="text" id="dirprop" name="dirprop" value="" size="60" maxlength="128"> <center><table width="700px" border="0"> <tr width="100%"><td width="90px">Vía
</td> <td width="40px">Num
</td> <td width="50px">Apend.
</td> <td width="60px">Orient.
</td> <td width="40px">CON
</td> <td width="40px">Num.
</td> <td width="50px">Apend.
</td> <td width="60px">Orient.
</td> <td width="40px">Placa
</td> <td width="80px">Comple.
</td> <select id="dirprop_tipovia" name="dirprop_tipovia" value="" align="left" onChange="dirprop()"> <input type="text" id="dirprop_numvia" name="dirprop_numvia" value="" size="3" maxlength="3" onChange="dirprop"></td> <select id="dirprop_apevia" name="dirprop_apevia" value="" align="left" onChange="dirprop"> <select id="dirprop_orivia" name="dirprop_orivia" value="" align="left" onChange="dirprop"> <input type="text" id="dirprop_numcruce" name="dirprop_numcruce" value="" size="3" maxlength="3" onChange="dirprop"></td> <select id="dirprop_apecruce" name="dirprop_apecruce" value="" align="left" onChange="dirprop"> <select id="dirprop_oricruce" name="dirprop_oricruce" value="" align="left" onChange="dirprop"> <input type="text" id="dirprop_numplaca" name="dirprop_numplaca" value="" size="3" maxlength="3" onChange="dirprop"></td> <input type="text" id="dirprop_complemento" name="dirprop_complemento" value="" size="7" maxlength="7" onChange="dirprop"></td>