Foros del Web » Programando para Internet » Javascript »

duda

Estas en el tema de duda en el foro de Javascript en Foros del Web. Hola amigos, tengo el siguiente codigo pero no funciona y el motivo es por el <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> y me pregunto ...
  #1 (permalink)  
Antiguo 13/11/2008, 22:04
 
Fecha de Ingreso: julio-2007
Ubicación: /home/victor
Mensajes: 114
Antigüedad: 16 años, 9 meses
Puntos: 0
duda

Hola amigos, tengo el siguiente codigo pero no funciona y el motivo es por el
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

y me pregunto si alguien me puede ayudar arreglarlo, de ante mano gracias

Código PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<
html>
<
head>
<
script type="text/javascript">
function 
agregar_fila(origen,destino) {

    var 
region   origen.regiones.value;
    var 
territorio origen.territorio.value;
    var 
provincia origen.provincia.value;
    var 
comuna origen.comuna.value;
    var 
localidad origen.value;
    
    var 
nuevo_indice destino.rows.length;

    var 
fila;
    var 
celda;
    var 
valor;
    
    
fila destino.insertRow(nuevo_indice);
    
fila.style.background "white";
    
    
celda fila.insertCell(0);
    
valor document.createElement("input");
        
valor.type "checkbox";
        
valor.id "marca[]";
        
valor.value nuevo_indice;
    
celda.appendChild(valor);

    
celda fila.insertCell(1);
    var 
region document.createElement('input'
        
region.type 'hidden'

    
var region_id document.getElementById('regiones');
        var 
txtTextObj document.getElementById('txtText');
        
    var 
selIndex region_id.selectedIndex;
        
region.value region_id.options[selIndex].text;    

    
valor document.createTextNode(region.value);
    
celda.appendChild(valor);
    
    
celda fila.insertCell(2);
    var 
territorio document.createElement('input'
        
territorio.type 'hidden'

    
var territorio_id document.getElementById('territorio');
        var 
txtTextObj document.getElementById('txtText');

    var 
selIndex territorio_id.selectedIndex;
        
territorio.value territorio_id.options[selIndex].text;    

    
valor document.createTextNode(territorio.value);
    
celda.appendChild(valor);
    
    
celda fila.insertCell(3);
    var 
provincia document.createElement('input'
        
provincia.type 'hidden'

    
var provincia_id document.getElementById('provincia');
        var 
txtTextObj document.getElementById('txtText');

    var 
selIndex provincia_id.selectedIndex;
        
provincia.value provincia_id.options[selIndex].text;    

    
valor document.createTextNode(provincia.value);
    
celda.appendChild(valor);
    
    
celda fila.insertCell(4);
    var 
comuna document.createElement('input'
        
comuna.type 'hidden'

    
var comuna_id document.getElementById('comuna');
        var 
txtTextObj document.getElementById('txtText');

        
    var 
selIndex comuna_id.selectedIndex;
        
comuna.value comuna_id.options[selIndex].text;    

    
valor document.createTextNode(comuna.value);
    
celda.appendChild(valor);
    
    
celda fila.insertCell(5);
    var 
localidad document.createElement('input'
        
localidad.type 'hidden'
        
localidad.name 'localidad[]'

    
var localidad_id document.getElementById('localidad');
        var 
txtTextObj document.getElementById('txtText');
        
    var 
selIndex localidad_id.selectedIndex;
        
localidad.value localidad_id.options[selIndex].text;    

    
valor document.createTextNode(localidad.value);
    
celda.appendChild(valor);
    
    
celda fila.insertCell(6);
    var 
latitud document.createElement('input'// latitud
        
latitud.type 'text'
        
latitud.name 'latitud[]'
        
        
celda.appendChild(latitud);

    
celda fila.insertCell(7);
    var 
longitud document.createElement('input'// longitud
        
longitud.type 'text'
        
longitud.name 'longitud[]'
        
        
celda.appendChild(longitud);

    
celda fila.insertCell(8);
    var 
monto document.createElement('input'// montos
        
monto.type 'text'
        
monto.name 'montos[]'
        
        
celda.appendChild(monto);

    var    
region document.createElement('input'// territorio
        
region.type 'hidden'
        
region.name 'regiones[]'

    
var region_id document.getElementById('regiones');
        var 
txtidObj document.getElementById('txtid');

    var 
selIndex region_id.selectedIndex;
        
region.value region_id.options[selIndex].id;

        
region.innerHTML=region;
        
celda.appendChild(region);            

    var    
territorio document.createElement('input'// territorio
        
territorio.type 'hidden'
        
territorio.name 'territorios[]'

    
var territorio_id document.getElementById('territorio');
        var 
txtidObj document.getElementById('txtid');

    var 
selIndex territorio_id.selectedIndex;
        
territorio.value territorio_id.options[selIndex].id;

        
territorio.innerHTML=territorio;
        
celda.appendChild(territorio);            

    var    
provincia document.createElement('input'// territorio
        
provincia.type 'hidden'
        
provincia.name 'provincias[]'

    
var provincia_id document.getElementById('provincia');
        var 
txtidObj document.getElementById('txtid');

    var 
selIndex provincia_id.selectedIndex;
        
provincia.value provincia_id.options[selIndex].id;

        
provincia.innerHTML=provincia;
        
celda.appendChild(provincia);            

    var    
comuna document.createElement('input'// territorio
        
comuna.type 'hidden'
        
comuna.name 'comunas[]'

    
var comuna_id document.getElementById('comuna');
        var 
txtidObj document.getElementById('txtid');

    var 
selIndex comuna_id.selectedIndex;
        
comuna.value comuna_id.options[selIndex].id;

        
comuna.innerHTML=comuna;
        
celda.appendChild(comuna);            

    var    
localidad document.createElement('input'// territorio
        
localidad.type 'hidden'
        
localidad.name 'localidades[]'

    
var localidad_id document.getElementById('localidad');
        var 
txtidObj document.getElementById('txtValue');

    var 
selIndex localidad_id.selectedIndex;
        
localidad.value localidad_id.options[selIndex].value;

        
localidad.innerHTML=localidad;
        
celda.appendChild(localidad);            
        

}

function 
remover_filas_marcadas(origen) {
    
///////////////////////////////////////////

    
var inputs origen.getElementsByTagName("input");
    var 
checkboxes = new Array();
    var 
chk_cuenta 0;
    
    
///////////////////////////////////////////

    
for (i=0i<inputs.lengthi++)
    {
        if (
inputs[i].type == "checkbox" &&
            
inputs[i].id == "marca" &&
            
inputs[i].checked)
        {
            
checkboxes[chk_cuenta] = inputs[i];
            
chk_cuenta ++;
        }
    }

    
///////////////////////////////////////////

    
for (i=0i<checkboxes.lengthi++)
    {
        
origen.deleteRow(checkboxes[i].value 1*i);
    }    

    
///////////////////////////////////////////
    
    
corregir_indices_tabla(origen);

    
///////////////////////////////////////////
}

function 
corregir_indices_tabla(origen) {
    
///////////////////////////////////////////

    
var inputs origen.getElementsByTagName("input");
    
    
///////////////////////////////////////////

    
for (i=0i<inputs.lengthi++)
    {
        if (
inputs[i].type == "checkbox" &&
            
inputs[i].id == "marca")
        {
            
inputs[i].value 1;
        }
    }

    
///////////////////////////////////////////
}
</script>
</head>

<body>

<form id="form" name="form" method="post">

        <select name="regiones" id="regiones" class="required" title="Seleccione la regi&oacute;n">
        <option value="" selected="selected">Seleecione</option>
        <option id="2" value="2">ANTOFAGASTA</option>
        <option id="3" value="3">COPIAPO</option>
        <option id="4" value="4">COQUIMBO</option>
        <option id="1" value="1">TARAPACA</option>

        <option id="5" value="5">VALPARAISO</option>
                </select>*


        <select name="territorio" id="territorio" class="required" title="Seleccione la regi&oacute;n">
        <option value="" selected="selected">Seleecione</option>
        <option id="2" value="2">ANTOFAGASTA</option>
        <option id="3" value="3">COPIAPO</option>
        <option id="4" value="4">COQUIMBO</option>
        <option id="1" value="1">TARAPACA</option>

        <option id="5" value="5">VALPARAISO</option>
                </select>*

        <select name="provincia" id="provincia" class="required" title="Seleccione la regi&oacute;n">
        <option value="" selected="selected">Seleecione</option>
        <option id="2" value="2">ANTOFAGASTA</option>
        <option id="3" value="3">COPIAPO</option>
        <option id="4" value="4">COQUIMBO</option>
        <option id="1" value="1">TARAPACA</option>

        <option id="5" value="5">VALPARAISO</option>
                </select>*

        <select name="comuna" id="comuna" class="required" title="Seleccione la regi&oacute;n">
        <option value="" selected="selected">Seleecione</option>
        <option id="2" value="2">ANTOFAGASTA</option>
        <option id="3" value="3">COPIAPO</option>
        <option id="4" value="4">COQUIMBO</option>
        <option id="1" value="1">TARAPACA</option>

        <option id="5" value="5">VALPARAISO</option>
                </select>*


        <select name="localidad" id="localidad" class="required" title="Seleccione la regi&oacute;n">
        <option value="" selected="selected">Seleecione</option>
        <option id="2" value="2">ANTOFAGASTA</option>
        <option id="3" value="3">COPIAPO</option>
        <option id="4" value="4">COQUIMBO</option>
        <option id="1" value="1">TARAPACA</option>

        <option id="5" value="5">VALPARAISO</option>
                </select>*



<input type="button" id="agregar" name="agregar" value="Agregar" onClick="agregar_fila(form,info)" />
<input type="button" id="remover" name="remover" value="Remover" onClick="remover_filas_marcadas(info)" />


</form>

<table class="ensayo" id="info" name="info">
<tr class="titulos">
    <td>&nbsp;</td>
    <td>Region</td>
    <td>Territorio</td>    
    <td>Provincia</td>
    <td>Comuna</td>
    <td>Localidad</td>
    <td>Latitud</td>
    <td>Longitud</td>
    <td>Monto</td>
</tr>
</table>

</body>
</html> 
  #2 (permalink)  
Antiguo 13/11/2008, 22:32
Avatar de kaninox  
Fecha de Ingreso: septiembre-2005
Ubicación: In my House
Mensajes: 3.597
Antigüedad: 18 años, 7 meses
Puntos: 49
Respuesta: duda

porque no usas ..

Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
o solo

Código:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
y nos cuentas
__________________
Gokuh Salvo al mundo. PUNTO!!!!
  #3 (permalink)  
Antiguo 13/11/2008, 22:54
 
Fecha de Ingreso: julio-2007
Ubicación: /home/victor
Mensajes: 114
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: duda

gracias, funciono con

Código PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:11.