Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/10/2009, 06:55
joaowizard
 
Fecha de Ingreso: abril-2009
Ubicación: Miami
Mensajes: 182
Antigüedad: 15 años
Puntos: 8
Sonrisa Ayuda para principiante!!

Hola a todos .. como el asunto dice soy principiante en Ajax ... he leido bastante y además ejecutado en mi PC algunos ejemplos para ir familiarizándome .. el asunto es que decidí hacer mi primer AJAX por mi mismo, y estoy intentando hacer una paleta de colores, en la que el usuario puede seleccionar un color en la paleta y el mismo estrará en un combo de un form, hasta ahí todo bien, mi código es el siguiente:

formulario.php tengo:

<script language='javascript'>

function nuevoAjax(){
var xmlhttp=false;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}

if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}

function AsingaColor(color){
var contenedor;
contenedor = document.getElementById('contenedor');
ajax=nuevoAjax();
ajax.open("GET", "test.php?color="+color,true);
ajax.onreadystatechange=function() {
if (ajax.readyState==4) {
contenedor.innerHTML = ajax.responseText
}
}
ajax.send(null)
}
</script>

<table>

<tr>
<td style="background-color: rgb(0, 0, 0); cursor: pointer;" onclick='AsingaColor("#000000")' width="14" height="14"></td>
<td style="background-color: rgb(0, 0, 51); cursor: pointer;" onclick='AsingaColor("#000033")' width="14" height="14"></td>
<td style="background-color: rgb(0, 0, 102); cursor: pointer;" onclick='AsingaColor("#000066")' width="14" height="14"></td>
******aca van muchos colores mas ....
</tr>
</table>

<br> <div id='contenedor'> </div>


y acá mi página que recibe test.php
<form action="" method="get">
<input name="" type="text" value="<?php $_GET['color']?>" />
</form>

¿mi problema?.. no funciona .. quizá estoy haciendo algo mal ... por favor una ayuda .. GRACIAS .. !!
__________________
-----------------------------------
Éxitos !!! .. joao