Ver Mensaje Individual
  #2 (permalink)  
Antiguo 28/01/2011, 10:46
waldette
 
Fecha de Ingreso: enero-2011
Mensajes: 2
Antigüedad: 13 años, 3 meses
Puntos: 0
Respuesta: Cargar .js dentro de DIV

Pongo el ejemplo para que quede claro.
La cosa está en que solo me funciona UNA SOLA VEZ!
Es suuuper simple, hay únicamente dos links, si le doy por primera vez a uno funciona a la perfeccion, pero a la que cambio y vuelvo de nuevo ya no funciona.

El archivo al que llamo es un fancybox, una ventana emergente con javascript...

Alguien me ayuda plis??

index.php

Código HTML:
<!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" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Carga DIV Ajax</title>

<script language="javascript" src="jquery.js"></script>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script language="javascript">
	function ajaxdiv(){
		$.ajax( {
			async:true,
			dataType: "html",
			type: "POST",
			url: "foro.php",
			data: "",
			global: true,
			ifModified: false,
			processData:true,
			contentType: "application/x-www-form-urlencoded",
			success: function(datos){
				$("#contenedor").html(datos)
				
			}
		});
}
		function ajaxdiv2(){
		$.ajax( {
			async:true,
			dataType: "html",
			type: "POST",
			url: "text.php",
			data: "",
			global: true,
			ifModified: false,
			processData:true,
			contentType: "application/x-www-form-urlencoded",
			success: function(datos){
				$("#contenedor").html(datos)
				
			}
		});
	}
</script>
<style type="text/css">
#menu{
float:left;
width:150px;
height: 400px;
border: 3px solid black;
padding: 5px;
padding-left: 8px;

}

#menu a{
padding: 3px 1px;
display: block;
width: 100%;
text-decoration: none;
font-weight: bold;
border-bottom: 1px solid gray;
}

#menu a:hover{
background-color: #FFFF80;
}

#contenedor{
float:left;
width:950px;
min-height: 400px;
border: 3px solid black;
margin-left: 10px;
padding: 5px;
padding-bottom: 8px;
}

* html #contenedor{ /*IE only style*/
height: 400px;
}
</style>
</head>

<body>
<div id="menu">
<a href="javascript:ajaxdiv();">Menu 1</a>
<br>
<a href="javascript:ajaxdiv2();">Menu 2</a>
</div>

<div id="contenedor"><h3>Prova!</h3></div>

</body>

</html>