rsarun
04-21-2006, 02: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
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