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

thickbox con ajax llamando la funcion

Estas en el tema de thickbox con ajax llamando la funcion en el foro de Frameworks JS en Foros del Web. Tengo una pagina web en asp classic donde en una seccion mando llamar pormedio de un js otra pagina por medio de ajax <script src="funciones.js" ...
  #1 (permalink)  
Antiguo 25/01/2012, 02:45
Avatar de Fabu_dina  
Fecha de Ingreso: enero-2004
Mensajes: 425
Antigüedad: 20 años, 3 meses
Puntos: 1
thickbox con ajax llamando la funcion

Tengo una pagina web en asp classic donde en una seccion mando llamar pormedio de un js otra pagina por medio de ajax

<script src="funciones.js" language="JavaScript"></script>


Código Javascript:
Ver original
  1. addEvent(window,'load',inicializarEventos,false);
  2.  
  3. function inicializarEventos()
  4. {
  5.   cargarPagina('produ.asp?cate='+cate);
  6. }
  7.  
  8. function presionEnlace(e)
  9. {
  10.   if (window.event)
  11.   {
  12.     window.event.returnValue=false;
  13.     var url=window.event.srcElement.getAttribute('href');
  14.     cargarPagina(url);    
  15. //  alert(url);
  16.   }
  17.   else
  18.     if (e)
  19.     {
  20.       e.preventDefault();
  21.       var url=e.target.getAttribute('href');
  22.       cargarPagina(url);    
  23. //  alert(url);
  24.     }
  25. // window.scrollTo(0,0);
  26. }
  27.  
  28.  
  29. var conexion1;
  30. function cargarPagina(url)
  31. {
  32.  
  33.   if(url=='')
  34.   {
  35.     return;
  36.   }
  37.   conexion1=crearXMLHttpRequest();
  38.   conexion1.onreadystatechange = procesarEventos;
  39.   conexion1.open("GET", url, true);
  40.   conexion1.send(null);
  41. //  window.scrollTo(0,270);
  42. //      $(document).ready(function() {
  43. //
  44. //          $("#various2").fancybox({
  45. //              'width'             : '55%',
  46. //              'height'            : '55%',
  47. //              'autoScale'         : false,
  48. //              'transitionIn'      : 'none',
  49. //              'transitionOut'     : 'none',
  50. //              'type'              : 'iframe'
  51. //          });
  52. //      });
  53. }
  54.  
  55. function procesarEventos()
  56. {
  57.   var detalles = document.getElementById("center_content");
  58.   if(conexion1.readyState == 4)
  59.   {
  60.     detalles.innerHTML = conexion1.responseText;
  61.     var ob21=document.getElementById('sig');
  62.     if (ob21!=null)
  63.       addEvent(ob21,'click',presionEnlace,false);
  64.     var ob22=document.getElementById('ant');
  65.     if (ob22!=null)
  66.       addEvent(ob22,'click',presionEnlace,false);
  67.     var ob23=document.getElementById('sigu');
  68.     if (ob23!=null)
  69.       addEvent(ob23,'click',presionEnlace,false);
  70.     var ob24=document.getElementById('ante');
  71.     if (ob24!=null)
  72.       addEvent(ob24,'click',presionEnlace,false);
  73.  
  74.  
  75.     var ob1=document.getElementById('1');
  76.     if (ob1!=null)
  77.       addEvent(ob1,'click',presionEnlace,false);
  78.     var ob2=document.getElementById('2');
  79.     if (ob2!=null)
  80.       addEvent(ob2,'click',presionEnlace,false);
  81.     var ob3=document.getElementById('3');
  82.     if (ob3!=null)
  83.       addEvent(ob3,'click',presionEnlace,false);
  84.     var ob4=document.getElementById('4');
  85.     if (ob4!=null)
  86.       addEvent(ob4,'click',presionEnlace,false);
  87.     var ob5=document.getElementById('5');
  88.     if (ob5!=null)
  89.       addEvent(ob5,'click',presionEnlace,false);
  90.     var ob6=document.getElementById('6');
  91.     if (ob6!=null)
  92.       addEvent(ob6,'click',presionEnlace,false);
  93.     var ob7=document.getElementById('7');
  94.     if (ob7!=null)
  95.       addEvent(ob7,'click',presionEnlace,false);
  96.     var ob8=document.getElementById('8');
  97.     if (ob8!=null)
  98.       addEvent(ob8,'click',presionEnlace,false);
  99.     var ob9=document.getElementById('9');
  100.     if (ob9!=null)
  101.       addEvent(ob9,'click',presionEnlace,false);
  102.     var ob10=document.getElementById('10');
  103.     if (ob10!=null)
  104.       addEvent(ob10,'click',presionEnlace,false);
  105.      
  106.     var ob11=document.getElementById('11');
  107.     if (ob11!=null)
  108.       addEvent(ob11,'click',presionEnlace,false);
  109.     var ob12=document.getElementById('12');
  110.     if (ob12!=null)
  111.       addEvent(ob12,'click',presionEnlace,false);
  112.     var ob13=document.getElementById('13');
  113.     if (ob13!=null)
  114.       addEvent(ob13,'click',presionEnlace,false);
  115.     var ob14=document.getElementById('14');
  116.     if (ob14!=null)
  117.       addEvent(ob14,'click',presionEnlace,false);
  118.     var ob15=document.getElementById('15');
  119.     if (ob15!=null)
  120.       addEvent(ob15,'click',presionEnlace,false);
  121.     var ob16=document.getElementById('16');
  122.     if (ob16!=null)
  123.       addEvent(ob16,'click',presionEnlace,false);
  124.     var ob17=document.getElementById('17');
  125.     if (ob17!=null)
  126.       addEvent(ob17,'click',presionEnlace,false);
  127.     var ob18=document.getElementById('18');
  128.     if (ob18!=null)
  129.       addEvent(ob18,'click',presionEnlace,false);
  130.     var ob19=document.getElementById('19');
  131.     if (ob19!=null)
  132.       addEvent(ob19,'click',presionEnlace,false);
  133.     var ob20=document.getElementById('20');
  134.     if (ob20!=null)
  135.       addEvent(ob20,'click',presionEnlace,false);
  136. //    window.scrollTo(0,0);
  137.  
  138. }
  139.   else
  140.   {
  141.     detalles.innerHTML = '<img src="../images/loading.gif">';
  142.   }
  143. }
  144.  
  145. //***************************************
  146. //Funciones comunes a todos los problemas
  147. //***************************************
  148. function addEvent(elemento,nomevento,funcion,captura)
  149. {
  150.   if (elemento.attachEvent)
  151.   {
  152.     elemento.attachEvent('on'+nomevento,funcion);
  153.     return true;
  154.   }
  155.   else  
  156.     if (elemento.addEventListener)
  157.     {
  158.       elemento.addEventListener(nomevento,funcion,captura);
  159.       return true;
  160.     }
  161.     else
  162.       return false;
  163. }
  164.  
  165. function crearXMLHttpRequest()
  166. {
  167.   var xmlHttp=null;
  168.   if (window.ActiveXObject)
  169.     xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  170.   else
  171.     if (window.XMLHttpRequest)
  172.       xmlHttp = new XMLHttpRequest();
  173.   return xmlHttp;
  174. }


dentro de produ.asp intento poner lo siguiente:

Código HTML:
Ver original
  1. <a href="details1.asp?cate=<%=Session("cate")%>&amp;ide=<%=rsProdInfo("pro_ide") %>" class="thickbox" title="add a caption to title attribute / or leave blank">No-scroll content</a>

Que deberia de funcionar el problema esta que no puedo cargar el link al archivo js o css por lo cual me abre la pagina del link en la ventana y no hace el efecto ThickBox

Código HTML:
Ver original
  1. <script type="text/javascript" src="../includes/js/thickbox.js"></script>
  2. <link rel="stylesheet" href="../includes/css/thickbox.css" type="text/css" media="screen" />

porque si dentro del archivo final pongo esto si me funciona

Código HTML:
Ver original
  1. <script type="text/javascript" src="../includes/js/thickbox.js"></script>
  2. <link rel="stylesheet" href="../includes/css/thickbox.css" type="text/css" media="screen" />
  3. <a href="details1.asp?cate=<%=Session("cate")%>&amp;ide=<%=rsProdInfo("pro_ide") %>" class="thickbox" title="add a caption to title attribute / or leave blank">No-scroll content</a>


En cual de los archivos tendria que ir para que haga los efectos???
  #2 (permalink)  
Antiguo 25/01/2012, 08:49
Avatar de maycolalvarez
Colaborador
 
Fecha de Ingreso: julio-2008
Ubicación: Caracas
Mensajes: 12.120
Antigüedad: 15 años, 8 meses
Puntos: 1532
Respuesta: thickbox con ajax llamando la funcion

debe evaluar también conexion1.status == 200, consulte un manual de AJAX, es el error más común
__________________
¡Por favor!: usa el highlight para mostrar código
El que busca, encuentra...

Etiquetas: ajax, funcion, html, js, thickbox
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 17:14.