Register • FAQ • Memberlist • Usergroups • Tutorials Point • Log in

| Page 1 of 1

Serialization problem
Author | Message
--- | ---
robinrl Joined: 18 Sep 2008 Posts: 1 | Serialization problem I have been working through the serialization tutorial and I want to do the same thing with images it would be perfect for what i am working on at the moment. I am new to javascript etc and would like to know if this is possible and if it is could someone tell me what I am doing wrong. It all works but the code in the button it doesn't give me any values just name[]=&name[]=&name[]=&name[]=

###### Code:

<html>
<head>
<title>Sorting Example</title>
<script src="javascripts/prototype.js" type="text/javascript"></script>
<script src="javascripts/scriptaculous.js" type="text/javascript"></script>
<script type="text/javascript">
window.onload = function() {
Sortable.create('imagelist',{tag:'div'});
}
function serialize(container, name){
$('display').innerHTML =
'Serialization of ' + $(container).id + ' is: <br/><pre>' +
Sortable.serialize( container,{ name:name} ) + '</pre>';
}
</script>
<style type="text/css">
div { cursor: move; }
img { border: 1px solid red; margin:5px; }
</style>
</head>
<body>
<p>Drag and drop list images to re-arrange them</p>
<div id="imagelist">
<div><img src="one.jpg"/></div>
<div><img src="two.jpg"/></div>
<div><img src="three.jpg"/></div>
<div><img src="four.jpg"/></div>
</div>
<p>Click following button to see serialized list which can be
passed to backend script, like PHP, AJAX or CGI</p>
<button type="button" value="Click Me"
onclick="serialize('imagelist', 'name')"> Serialize
</button>
<div id="display" style="clear:both;padding-top:32px"></div>
</body>
</html>
_________________
Thanks
Robin
Thu Sep 18, 2008 12:18 am |

Display posts from previous: |

| Page 1 of 1

You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum

Powered by phpBB © phpBB Group Design by Vjacheslav Trushkin for phpBBStyles.com