?
Solved

save content of a div

Posted on 2003-11-25
3
Medium Priority
?
814 Views
Last Modified: 2012-08-13
hello is it possible to save only the content of a div with execCommand('SaveAs') ?
0
Comment
Question by:ferryl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
jaysolomon earned 80 total points
ID: 9817933
you could try this

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
<!--
function newWin(theDiv){
      var nw = window.open("","newWin");
      var docWrite = nw.document.write;
            docWrite('<html>\n<body>\n');
            docWrite('<script>document.write(opener.document.getElementById(\''+theDiv+'\').innerHTML)<\/script>\n');
            docWrite('<form name="form1">\n');
            docWrite('<input type="button" name="btn" value="Save As" onclick="document.execCommand(\'SaveAs\');">\n');
            docWrite('<\/form>\n');
            docWrite('<\/body>\n<\/html>');
}
// -->
</script>
</head>
<body>
<a href="#" onclick="newWin('myDiv');return false;">Save As</a>
<div id="myDiv">
      this is some content
      this is some content
      this is some content
      this is some content
</div>      
</body>
</html>
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 10383689
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: jaysolomon {http:#9817933}

Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jAy
EE Cleanup Volunteer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question