Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

save content of a div

Posted on 2003-11-25
3
Medium Priority
?
815 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…

610 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