Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/11/2010, 09:59
Avatar de VencerNow
VencerNow
 
Fecha de Ingreso: noviembre-2010
Ubicación: Mexico D.F.
Mensajes: 27
Antigüedad: 13 años, 6 meses
Puntos: 1
[ayuda] con script ajax

Hola como estan bueno tengo un script con ajax para llamar html dentro de un div(creo) pero no se si esta bien, el problema es que quiero llamar una pag ya esa thml o php dentro de un div mediante un link que contiene un span, pero no se si falla mi script por que suse den dos cosas:
*si junto dos veses seguidas el sapn con las funciones mousein y out se va y ya no le da ejecuta la imagen de mouse in.
*la otra que al darle click al botón(imagen) no pasa nada
Les dejo la muestra de mu script ajax, como inserto el boton y como tengo el div.

Script AJAX

Código Javascript:
Ver original
  1. <script language="javascript">
  2.  
  3.         // FUNCION AJAX PARA LA CARGA DE LAS SECCIONES
  4.  
  5.         function LINK_ajax(http, div_name)  {
  6.  
  7.  
  8.  
  9.             var LINK_xmlhttp = false;
  10.  
  11.  
  12.  
  13.             try { LINK_xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
  14.  
  15.             catch (e) { try { LINK_xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
  16.  
  17.             catch (e) { try { LINK_xmlhttp = new XMLHttpRequest(); }
  18.  
  19.             catch (e) { LINK_xmlhttp = false; }}}
  20.  
  21.             if (!LINK_xmlhttp) return null;
  22.  
  23.    
  24.  
  25.             //document.getElementById('load_div').style.visibility="visible";
  26.  
  27.  
  28.  
  29.             LINK_xmlhttp.open("GET", http, true);
  30.  
  31.  
  32.  
  33.             LINK_xmlhttp.onreadystatechange = function() {
  34.  
  35.                 if (LINK_xmlhttp.readyState == 4) {
  36.  
  37.                     if (LINK_xmlhttp.responseText.indexOf('ALERT|') > -1) {
  38.  
  39.                         var x = LINK_xmlhttp.responseText.indexOf('ALERT|') + "ALERT|".length;
  40.  
  41.                         var y = LINK_xmlhttp.responseText.indexOf('|ENDALERT') - x;
  42.  
  43.                         window.alert(LINK_xmlhttp.responseText.substr(x , y));
  44.  
  45.                     } else
  46.  
  47.                         document.getElementById(div_name).innerHTML = LINK_xmlhttp.responseText + ' ';
  48.  
  49.                 }
  50.  
  51.             }
  52.  
  53.  
  54.  
  55.             LINK_xmlhttp.send(null);  
  56.  
  57.             return false;
  58.  
  59.         }
  60.  
  61.            
  62.  
  63.  
  64. //FUNCION DE PRE-CARGA DE IMAGENES
  65.  
  66.         if (document.images)
  67.  
  68.         {
  69.  
  70.             var menu = new Image();
  71.  
  72.             menu.src = "imagenes/menu/menu.png";
  73.  
  74.             var menu2 = new Image();
  75.  
  76.             menu2.src = "imagenes/menu/menu.png";
  77.            
  78.            
  79.            
  80.             var normas = new Image();
  81.  
  82.             normas.src = "imagenes/menu/Normas1.png";
  83.  
  84.             var normas2 = new Image();
  85.  
  86.             normas2.src = "imagenes/menu/Normas2.png";
  87.         }
  88.  
  89.  //MUESTRA LA IMAGEN CUANDO SE PASA POR ENCIMA EL BOTON
  90.  
  91.         function entra(boton) {
  92.  
  93.             if (document.images)
  94.  
  95.             {
  96.  
  97.                     if (boton == 'menu')
  98.  
  99.                     document.images[boton].src = menu.src;
  100.                    
  101.                     if (boton == 'normas')
  102.  
  103.                     document.images[boton].src = normas2.src;
  104.             }
  105.  
  106.         }
  107.  
  108.  
  109. //MUESTRA LA IMAGEN ORIGINAL
  110.  
  111.         function sale(boton) {
  112.  
  113.                     if (document.images)
  114.  
  115.                     {
  116.  
  117.  
  118.                     if (boton == 'menu')
  119.  
  120.                     document.images[boton].src = menu.src;
  121.                    
  122.                     if (boton == 'normas')
  123.  
  124.                     document.images[boton].src = normas.src;
  125.         }
  126.  
  127.         }
  128.        
  129. </script>

Boton(imagen)

Código HTML:
Ver original
  1. <span title="Nornas" style="cursor:pointer" onMouseOver="entra('normas');" onMouseOut="sale('normas');" onClick="return LINK_ajax('normas.html','divInfo');">
  2.  
  3.                     <img src="imagenes/menu/normas.png" border=0 name='normas'>
  4.  
  5.                 </span>

Div

Código HTML:
Ver original
  1. <div id="divInfo" style="overflow:auto; width:655; height:500; scrollbar-base-color:#0072bF; scrollbar-face-color:#0072bF; scrollbar-track-color:#0099CC; scrollbar-arrow-color:#0033CC;"></div>

Grax por adelantado y si no se entiende favor de decirme y gracias de nuevo.