Solved

save content of a div

Posted on 2003-11-25
3
811 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 20 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

733 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