iGuest 3 Report post Posted November 10, 2007 Hi.I'm currently working on a personal space type thing. Basically, you have a page, and you can place things on it, drag them around, and save them.At the moment, it's all working fine, except I have a major bug.When you place an object on a page, it appears there all right, but you aren't able to drag it, or any other objects, around. You have to get out of it, and get back in. You're able to click the button that deletes the item, but that's all. You can't even highlight text!I'm using the WZ Drag/Drop script for the dragging things around side of it, you can download it here to have a look at it.Here are the JavaScript functions for placing the object on the page: function GetXmlHttpObject(){ var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp;}function placeNote(id,text){ notetext = text; xmlHttp = GetXmlHttpObject(); xmlHttp.onreadystatechange = function() { addToPage(id); }; xmlHttp.open("GET", "placenote.php?id="+id+"&text="+notetext, true); xmlHttp.send(null);}function addToPage(id){ if (xmlHttp.readyState==4) { closewindow('sub'); //Closes the preview window which is currently up before the note goes on the page addtext = xmlHttp.responseText; document.getElementById('content').innerHTML += addtext; ADD_DHTML('note'+id); //This is a function from the wz_dragdrop script that lets the object be dragged around }} (Before the note's text reaches the function, it's converted into characters that won't stuff up the url. The characters are converted back below).And here's placenote.php:<?phpinclude("functions.php");checkAuth(); //checks that the user has permission to place the object$text = str_replace('%%AMP%%', '&', $_GET["text"]);$text = str_replace('%%HASH%%', '&', $text);$text = str_replace('%%SQUO%%', "'", $text);$text = str_replace('%%DQUO%%', '"', $text);$text = str_replace('%%AT%%', "@", $text);$updatetext = "update notes set contents = '".$text."' where nid = '".$_GET["id"]."' and home = '".$_COOKIE["habble_username"]."'";$updateinhand = "update notes set inhand = 'no' where nid = '".$_GET["id"]."' and home = '".$_COOKIE["habble_username"]."'";$getdetails = "select * from notes where nid = '".$_GET["id"]."' and home = '".$_COOKIE["habble_username"]."'";$gdresult = mysql_query($getdetails);$gdarray = mysql_fetch_array($gdresult);mysql_query($updatetext);mysql_query($updateinhand);$toecho = '<div id="note'.$_GET["id"].'" style="position: absolute; left: '.$gdarray["x"].'; top: '.$gdarray["y"].'; z-index: '.$gdarray["z"].'; '.$gdarray["extrastyle"].'; background-image: url('.$gdarray["background"].');"><a href="#" onClick="showAlert(\'delete\', \'&id='.$_GET['id'].'\');"><img align="right" src="images/button_delete.gif"></a>'.$text.'</div>';//$toecho = makeHtml($toecho); //MakeHtml converts the characters so they'll display properly on the pageecho $toecho;?> Also, there is a <div> on the page with an id "content", which is where all the objects are contained.If tehre's anything extra you need to know, just ask.And the big question: Can you help? Share this post Link to post Share on other sites