Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/10/2007, 10:10
Avatar de Gaby_Corr
Gaby_Corr
 
Fecha de Ingreso: junio-2005
Mensajes: 672
Antigüedad: 19 años, 10 meses
Puntos: 0
que tengo mal?? que en internet explorer no funciona!!!

sistemas.asp
Código:
<!-- #include file="../conexion.asp"-->

<%
sistema = request.Form("sistemas")
nombre = request.Form("nombre")
linea = request.Form("linea")

dim Metodo, funcion
Metodo = request.servervariables("REQUEST_METHOD")
funcion=request.Form("metodo")

function grabar(sistema,nombre,linea)
      call conectarDB
	    sSQL = "Select * From DS_sistemas where sistemas_id = "& sistema &" "
		Set rs = cnn.Execute(sSQL)
		if not rs.eof then
			 'response.Write(sistema) si existe el valor
        else 
	   sSQL = "Insert into DS_sistemas(sistemas_id, sistemas_nombre, sistemas_linea) VALUES ('"& sistema &"','"& nombre &"','"& linea &"')"
	   cnn.Execute(SSQL)
	   end if
	   rs.close
	   Set rs = nothing
	   
	   call desconectarDB  	
end function
	


if Metodo = "POST" then
    select case funcion
        case "Guardar"
            'call grabar(sistema,nombre,linea)
			response.write("http://www.google.com")

    end select
else

%>



<!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>Sistemas</title>
<link rel="stylesheet"  href="estilo_peticiones.css" />

<script language="javascript1.5" type="text/javascript">
function getHTTPObject() {
    var xmlhttp;
   /*@cc_on
    @if (@_jscript_version >= 5)
       try {
          xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
       } catch (e) {
          try {
             xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
          } catch (E) { xmlhttp = false; }
       }
    @else
    xmlhttp = false;
    @end @*/
	
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
       try {
          xmlhttp = new XMLHttpRequest();
       } catch (e) { xmlhttp = false; }
    }
    return xmlhttp;
}

var enProceso = false; // lo usamos para ver si hay un proceso activo
var http = getHTTPObject(); // Creamos el objeto XMLHttpRequest  

function Busqueda(dato) {

    if (!enProceso && http) {
       var valor = escape(document.getElementById(dato).value);
//deberas cambiar esta parte y escribir la pagina correcta
       var url = "buscador.asp?Find="+ valor;
       http.open("GET", url, true);//+ "&raw=" + Math.random()
       http.onreadystatechange = handleHttpResponse;  
	   enProceso = true; 
	//alert(valor);
	   http.send(null); 
	alert('mensaje 8');
      
    }
}  

function handleHttpResponse(){
	//if (http.readyState==1){document.getElementById("respuesta").innerHTML = imagen;}
    if (http.readyState == 4){
       if (http.status == 200) {
          if (http.responseText.indexOf('invalid') == -1){
			  document.getElementById("respuesta").innerHTML = "";
             // Armamos un array, usando la coma para separar elementos
             results = unescape(http.responseText);//.split(","));
			//Estos campos debes cambiarlos a los que tienes en tu formulario
			
             document.getElementById("respuesta").innerHTML = results;//[0];
             enProceso = false;
          }
		}
		else
			{
			document.getElementById("respuesta").innerHTML = "";
			mensaje = unescape(http.responseText);//.split(",");
			document.getElementById("respuesta").innerHTML = mensaje;
			enProceso = false;
			}
       }
    }

function Mtdos(idCapa)
{
alert("entra a la funcion");
document.getElementById('metodo').value=idCapa.value;
alert("sigue el submit");
document.form1.submit();
alert("ya hizo el submit");

}
</script>

</head>

<body onload="MM_preloadImages('images/btn_inicio.jpg','images/btn_peticion.jpg','images/btn_agregaract.jpg','images/btn_clasificarpet.jpg','images/btn_reportes.jpg','images/btn_catalogos.jpg','images/btn_ayuda.jpg')">
<!-- #include file = "menupet.html" -->

<div style="text-align:center;">
<table  border="0" cellpadding="0" cellspacing="0" id="tbcontenido" width="100%" >
	<tr><td class="titulo"> Sistemas </td></tr>
	<tr><td style="background-image: url(images/fondo_B12.gif); background-repeat: no-repeat; height:18px; background-color: #fff;"></td></tr>

	<tr><td>
	  <!-- tabla de contenido -->
	<table border="0" width="750" cellpadding="0" cellspacing="0">
		  <tr>
			<td style="background-image:url(images/fondo_B4.gif); background-repeat:repeat-y; width:16px;"></td>			  
			<td width="718">
			<!-- inicio del div contenedor_pet -->
			<div id="contenedor_pet">
				<form method="post" action="Sistemas.asp" id="form1" name="form1">
				
					<table width="100%" cellpadding="0" cellspacing="0">		    
						<tr><td>Número de Sistema: <br /><span class="dtobligatorio"> * </span>
							<input name="sistemas" type="text" id="sistemas" value="" size="20" maxlength="20" onblur="Busqueda(this.id)" />
							<!--<input name="sistemas" type="text" id="sistemas" value="" size="20" maxlength="20" onchange="mostrarbtnguardar()" onblur="Busqueda(this.id)" />-->
							<input name="ver" type="image" id="ver" value="ver" src="Images/20_VER1.jpg"  onclick="window.open('consultasistema.asp','mipag')"/>	</td></tr>
							
						<tr><td>Nombre del sistema: <br /><span class="dtobligatorio"> * </span>
                           <input name="nombre" type="text" id="nombre" value="" size="95" maxlength="30" />
						</td>
						</tr>
						<tr><td>Línea de sistemas:<br /><span class="dtobligatorio"> * </span>
						<input name="linea" type="text" id="linea" value="" size="95" maxlength="30"/>
						</td></tr>
						
						<tr><td><br /><br /></td></tr>						
					
						<!--<tr><td>
							   <table align="left">
								<tr>
									<td width="167" height="36">
											<input name="Guardar" type="image" id="Guardar" src="http://www.forosdelweb.com/images/GUARDAR1.gif" style=" visibility: hidden;" onclick="Mtdos(this)" />				  
									</td>
									<td width="167" height="36">
										   <input name="Modificar" type="image" id="Modificar" src="http://www.forosdelweb.com/images/modificar1.gif" style=" visibility:hidden;" />
									</td>
									<td width="159">
											<input name="Borrar" type="image"  id="Borrar" src="Images/ELIMINAR1.gif" style=" visibility: hidden;" /></td>
									<td width="72"> 
										<input  type="image" src="http://www.forosdelweb.com/images/IMPRIMIR1.gif" name="Imprimir" id="Imprimir" style=" visibility: hidden;" /></td>
								</tr>
							  <input type="hidden" id="metodo" name="metodo" />
							   
							</table>
						</td></tr>-->
						<tr><td class="dtobligatorio"><br /><br />(*) Datos obligatorios</td></tr>
								<div id="respuesta"></div>
					</table>
				</form>
			</div>  <!-- fin del div contenedor_pet -->
			
			</td>			  
			<td style="background-image:url(images/fondo_B2.gif); background-repeat:repeat-y; width:16px;"></td>
		  </tr>
		</table>  
	</td></tr>	
	  <!-- fin de tabla de contenido -->
	<tr><td style="background-image:url(images/fondo_B32.gif); background-repeat: no-repeat; height:23px;"></td></tr>
</table>
   
</div>

</body>
</html>

<% end if %>
buscador.asp
Código:
<!-- #include file="../conexion.asp" -->
<%
function buscar(sistema)      
	call conectarDB
	Dim sSQL, rs
	sSQL = "Select sistemas_id, sistemas_nombre, sistemas_linea FROM DS_Sistemas where sistemas_id = '"& sistema &"'"
	Set rs = cnn.execute(sSQL)    

	if Err=0 then
     if rs.eof then%>
	 <table>
	<tr><td width="167" height="36"><input name="Guardar" type="image" id="Guardar" src="http://www.forosdelweb.com/images/GUARDAR1.gif" style=" visibility: visible;" onclick="Mtdos(this)" /></td>
	<% else		
			c2 = rs.fields("sistemas_nombre").value
			c3 = rs.fields("sistemas_linea").value	%>	
		<table><tr>
		<td width="167"><input name="Modificar" type="image" id="Modificar" src="http://www.forosdelweb.com/images/modificar1.gif" style=" visibility:visible;" /></td>
		<td width="159"><input name="Borrar" type="image"  id="Borrar" src="Images/ELIMINAR1.gif" style=" visibility: visible;" /></td>
		<td width="72"><input  type="image" src="http://www.forosdelweb.com/images/IMPRIMIR1.gif" name="Imprimir" id="Imprimir" style=" visibility: visible;" /></td>
	<% end if %>
		  <input type="hidden" id="metodo" name="metodo" />  
	</tr>
</table>		
<%end if
call desconectarDB 
end function

	

' me fijo si viene algun valor en el querystring, si no viene nada, no hago nada
criterio = request.querystring("Find")
if criterio <> "" then
	call buscar(criterio)
else
	valores="La consulta no puede realizarse si no escribe algo, por favor<br/>"
	'response.Write valores
end if
%>

dudas:

1. no se ve en internet explorer al momento de buscar el dato(input-sistemas)
Ya verifique que mandara los valores en el onblur="Busqueda(this.id)" y si entra a la funcion busqueda
solo que me marca un error desconocido en tiempo de ejecución.

2. como le puedo hacer para que los botones de guardar, modificar y eliminar me aparezcan debajo
de los inputs que tengo en mi formulario

3. intento que entre a la funcion Mtdos() y no entra y no se por que?
onclick="Mtdos(this)"

ojala me pudierann orientar! gracias!

existe otra forma de hacerlo?? ayuda!!!
__________________
" Recuerda , estas donde debes estar ..."

Última edición por Gaby_Corr; 22/10/2007 a las 10:16 Razón: nombre de pagina