...

View Full Version : Saving the document after adding content dynamically



rsarun
04-21-2006, 03:11 PM
Hi All,

I am facing a certain problem when I try to add a content to a page dynamically and then save the page.
I add a content dynamically to the page on a mouse click and then after the content appears in the screen, I try to save the HTML file from the browser. When I open the saved HTML file, I am not able to see the dynamically added text. This happens only in IE.

This is the code that I use.
"document.body.insertAdjacentHTML("beforeEnd", "<div id='idCanvas'> Sample Text </div>");"

This code successfully adds the new text to the page. But, when I try to save the page from "File -> Save As" and then open the saved file, I am not able to view that text. I need to get that text in the saved document as well.

I also tried using

var oDiv = document.createElement("div");
oDiv.setAttribute("id","idCanvas");
var oText = document.createTextNode("SampleText")
oDiv.appendChild(oText);
document.body.appendChild(oDiv);


Even with this I am facing the same problem. In Firefox, I am able to get the dynamically added text but not in IE. Can anyone help me with this? :confused:

Thanks in Advance,
rsarun

Beagle
04-25-2006, 06:53 PM
To the best of my knowledge, it's not possible to save generated html through File->Save As in IE. You can get various IE developer tools that will let you see the generated HTML and then you could save that but I think that's the best you'll get. Sorry:(

rsarun
04-27-2006, 08:34 AM
I also thought that would be the case. I just wanted to confirm that. Anyways, thnx for your help. :)

Regards,
rsarun

rsarun
04-27-2006, 08:42 AM
I also thought that would be the case. I just wanted to confirm that. Anyways, thnx for your help. :)

Regards,
rsarun

felgall
04-28-2006, 12:01 AM
See http://javascript.about.com/library/blsource.htm for a script you can add to your favorites menu that will display the current (modified) source of the page in a separate window from which you can then save it.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum