How do I save a custom HTML page?

I made a drag and drop utility that allows users to drag and drop items directly to their workplace and create their own page, I wound up how I can save the user experience as an HTML page!

-1


source to share


8 answers


Do you mean the position of all elements? How about iterating through them and keeping their position? If you are using jQuery you can do something like this:

var positions = new Array();
function savePositionOfAllDivs() {
 $('div').each( function(){
  $this = $(this);
  id = $this.attr('id');
  position = $this.position();
  left = position.left;
  top = position.top;
  positions[id] = new Array();
  positions[id]['left'] = left;
  positions[id]['top'] = top;
 }
}

      



And then send the array of positions to some server side script that turns it into CSS, which can then be inserted into an HTML page that the user can download.

(With more details on how you are trying to do this, it might be easier and more efficient. Let's say this is a drag and drop order function, but you need to keep the order of the div s)

+1


source


Uhhm, hit the save button? Seriously though, I think you might want to add more information on your question, like which system you are using, etc. Etc.



0


source


document.getElementsByTagName ("BODY") [0] .innerHTML

0


source


It is possible to use XPath. You may find this discussion on SO helpful .

EDIT: Or maybe you could do with Node.childNodes. for more info check MDC here

0


source


Most jQuery drag and drop libraries have the ability to serialize elements that are dragged into an array that you can save. If you give me a link to the specific library you are using, I can tell you how to use it.

However, if you've done it yourself, you'll have to try one of the above suggestions.

0


source


Are you trying to find the best way to transfer HTML and CSS from the front to the server, or the best way to keep the HTML on the server (like in DB or File)?

0


source


I am using jquery and I made a drag and drop utility that you can use to place some html elements inside the page, I need to know how to save users in an HTML file that it can load or can view it work after saving

0


source


I need the same solution looking for a port. My scenario is I am creating a drag and drop cms. Users can drag and drop html elements to create their pages. Now how can I save these changes (in db or in var) of the session and should be able to create a static page with all the above changes that the user has made using php. Can someone shed some light. I am completely new to jquery and do not consider myself a php expert.

0


source







All Articles