Foros del Web » Programando para Internet » Javascript » Frameworks JS »

se pierde el valor de la var elmento

Estas en el tema de se pierde el valor de la var elmento en el foro de Frameworks JS en Foros del Web. <% alguien me puede ayudar porfavor sub genera_combo( sql,valor,nombre,id,evento,title,clase) Response.Write "<select class='"+clase+"' id="""+id+ """ name="""+nombre+""" "+evento+" title='"+title+"' >" Response.Write("<option value='-1'>Seleccione "+title+"... </option>") While not consulta.EOF ...
  #1 (permalink)  
Antiguo 16/03/2010, 09:37
 
Fecha de Ingreso: febrero-2008
Mensajes: 26
Antigüedad: 16 años, 1 mes
Puntos: 1
Sonrisa se pierde el valor de la var elmento

<%
alguien me puede ayudar porfavor

sub genera_combo( sql,valor,nombre,id,evento,title,clase)




Response.Write "<select class='"+clase+"' id="""+id+ """ name="""+nombre+""" "+evento+" title='"+title+"' >"
Response.Write("<option value='-1'>Seleccione "+title+"... </option>")
While not consulta.EOF

if consulta.Fields(0).value = valor then

Response.Write "<option selected=""selected"" value=""" & (consulta.fields(0).value) & """>" & Server.HTMLEncode(consulta.Fields(1).Value) & "</option>"

else
Response.Write "<option value=""" & (consulta.fields(0).value) & """>" & Server.HTMLEncode(consulta.Fields(1).Value) & "</option>"
end if
consulta.MoveNext
Wend
Response.Write "</select>"


consulta.Close()
Set consulta = Nothing
End sub


cod = Request.QueryString("seleccionado")
select_a_cargar = Request.QueryString("select_a_cargar")

response.Write cod

if select_a_cargar ="2" then
sql="SELECT D.CodDis,NombreCortoDis FROM ......"
sql=sql+" WHERE D.CodDis=DA.CodDis and DA.IdArea=A.IdArea and DA.IdArea="&cod

genera_combo sql,-1,"Dispositivos","select_2","","Dispositivo","comb o"


response.end()
end if%>

<script language="javascript" type="text/javascript">
function nuevoAjax()
{
/* Crea el objeto AJAX. Esta funcion es generica para cualquier utilidad de este tipo, por
lo que se puede copiar tal como esta aqui */
var xmlhttp=false;
try
{
// Creacion del objeto AJAX para navegadores no IE
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
// Creacion del objet AJAX para IE
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(E) { xmlhttp=false; }
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp=new XMLHttpRequest(); }

return xmlhttp;
}

function cargaContenido(selectACargar)
{
// Recibo el número correspondiente al combo que se debe llenar de datos
var selectAnterior=selectACargar-1; // Obtengo el número del combo que activó el evento onChange
// Extraigo el valor del combo que se ha cambiado
var valor=document.getElementById("select_"+selectAnte rior).options[document.getElementById("select_"+selectAnterior). selectedIndex].value;
var elemento=document.getElementById("fila_"+selectACa rgar);
if(valor!=-1)
{
ajax=nuevoAjax();

// Envio al servidor el valor seleccionado y el combo al cual se le deben poner los datos
alert(valor)
ajax.open("GET","test.asp?seleccionado="+valor+"&s elect_a_cargar=2", true);
ajax.onreadystatechange=function()
{
if (ajax.readyState==1)
{
// Mientras carga elimino la opcion "Elige" y pongo una que dice "Cargando"
elemento.innerHTML="Cargando...";
}
if (ajax.readyState==4)
{
// Coloco en la fila contenedora los datos que recivo del servidor
elemento.innerHTML=ajax.responseText;
}
}
ajax.send(null);
}
else
{
elemento.innerHTML="Elija Tipo";
}


}
</script>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>


<td class="CaptionCeldas" width="140" align="left">Estamento</td>
<td id="fila_1" Title="Area" width="200px">
<%genera_combo "SELECT IdArea,Descripcion FROM Areas",-1,"Areas","select_1","onChange=""cargaContenido(2) ""","Areas","combo" %> </td>
</td>



<td class="CaptionCeldas" width="140" align="left">Tipo</td>
<td id="fila_2" width="200px"> </td>
<option id="2" value="-1"></option></select>
</td>

</body>
</html>

Etiquetas: ajax, pierde, var
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 20:42.