Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/06/2010, 05:23
Tetoalux
 
Fecha de Ingreso: febrero-2010
Mensajes: 5
Antigüedad: 14 años, 2 meses
Puntos: 0
mover elementos otro DIV con prototype

Hola:

Soy nuevo con esto, asi que ando medio perdido, tengo una galeria de imagenes en un DIV 1, cuando el usuario le da click a una de las imagenes esta debe pasar al DIV 2, si esta en el DIV 2 debe pasar al DIV 3 y si esta en el DIV 3 debe regresar al DIV 1.

Esto es una tarea, y ya la hice con Jquery pero necesito hacerla con prototype tambien, pero no le hayo, cualquier ayuda lo agradecere muchisimo.

Mi problema es que no he podido hacer el append hacia el nuevo DIV

aqui esta el codigo de lo que tengo
Gracias

<html>
<head>
<title>jQuery test page</title>
<style>
body {background-color:#8b8; text-align:center; color:white;}
.photo {width:150px;left:15px;top:15px;float:left; padding:10px; border:groove 6px black; background-color:white;}
#lovepictures {clear:both;}
#hatepictures {clear:both;}
#allpictures {clear:both;}

</style>
<script type="text/javascript" src="http://prototypejs.org/assets/2009/8/31/prototype.js"></script>



<script>
Event.observe(window, 'load', page_loaded, false);

function page_loaded(event) {
Event.observe(window, 'click', item_clicked, false);
}

function item_clicked(event){
var child = Event.element(event);

if ($(child).descendantOf('allpictures'))
{
function showResult(){

alert('The child node with id=' + child.id + ' lo encontre');

}}
else {if ($(child).descendantOf('lovepictures'))
{
alert('The child node with id=' + child.id + ' lo encontre el love');

}}

{
}
/*var theNode = Event.getParentNode(event);*/
alert('The child node with id=' + child.id + ' was clicked');
Event.stop(event); //avoid another call related to 'parent_node' itself
}
</script>
...



</head>
<body>


<div id="myPictureDivs">
<div id="parent_node">
<div id="child1">First</div>
<div id="child2">Second</div>
<div id="child3">Third</div>
</div>
<div id="allpictures">
<h1>Hector Cervantes</h1>
<h6>A00757664 - Comp-2011</h6>
<h3> All Pictures </h3><br /><br />
<img class="photo" src="images/a.jpg"/>
<img class="photo" src="images/b.jpg"/>
<img class="photo" src="images/c.jpg"/>
<img class="photo" src="images/d.jpg"/>


</div>
<div id="lovepictures">
<h3>Pictures I love </h3><br /><br /><br />
<img class="photo" src="images/e.jpg"/>
</div>
<div id="hatepictures">
<h3>Pictures I hate </h3><br /><br /><br />
</div>

</div>

</body>
</html>