Este es el codigo completo, por si hay alguna duda:
Código HTML:
Ver original<!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"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="global.css" rel="stylesheet" type="text/css" media="screen" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> <script type="text/javascript" language="javascript"> var http_request = false;
function makePOSTRequest(url, parameters, funcion) {
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
// set type accordingly to anticipated content type
//http_request.overrideMimeType('text/xml');
http_request.overrideMimeType('text/html');
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Cannot create XMLHTTP instance');
return false;
}
http_request.onreadystatechange = funcion;
http_request.open('POST', url, true);
http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http_request.setRequestHeader("Content-length", parameters.length);
http_request.setRequestHeader("Connection", "close");
http_request.send(parameters);
}
function alertContents() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
//alert(http_request.responseText);
result = http_request.responseText;
document.getElementById('slides_container').innerHTML = result;
} else {
alert(http_request.status);
}
}
}
function get() {
var poststr = "eventos=" + encodeURI( document.getElementById("eventos").value );
makePOSTRequest('eventos.php', poststr, alertContents);
}
$(function(){
$('#slides').slides({
preload: true,
preloadImage: 'img/loading.gif',
play: 5000,
pause: 2500,
hoverPause: true
});
});
<div class="slides_container"> <a href="#" target="_blank"><img src="1.png"></a> <a href="#" target="_blank"><img src="2.png"></a> <a href="#" target="_blank"><img src="3.png"></a> <a href="#" target="_blank"><img src="4.png"></a> <a href="#" target="_blank"><img src="5.png"></a> <select name="eventos" id="eventos" onchange="javascript:get();">
eventos.php
Código PHP:
<?php
$eventos=$_POST['eventos'];
if($eventos==1){
echo "<a href='#' target='_blank'><img src='6.png'></a>"
."<a href='#' target='_blank'><img src='7.png'></a>";
}elseif($eventos==2){
echo "<a href='#' target='_blank'><img src='8.png'></a>"
."<a href='#' target='_blank'><img src='9.png'></a>"
."<a href='#' target='_blank'><img src='10.png'></a>";
}
?>