bjnst6
October 11th, 2002, 01:49 PM
here's an interesting one i think:
i'm trying to do this:
var theString = mytext.document.body.innerHTML;
alert(theString);
where mytext is an IFRAME element...the only IFRAME element on the page...and although i keep getting the alert with the innerHTML in it exactly like i want (for a test)...i also get an error that says: object required.
now the interesting thing is that i've done this same thing other places in the app and it's worked fine! hmmm....
----------
my html looks like this:
<td><IFRAME class="mytext" width="<%= strWidth %>" ID="mytext" height="100%"></IFRAME></td>
and my javascript looks like this:
// Initialize everything when the document is ready
var YInitialized = false;
function document.onreadystatechange()
{
YInitialized = true;
var i, s, curr;
var newEvt;
mytext.document.open();
mytext.document.write("<BODY bgcolor=\"#<%= strColor %>\" >");
mytext.document.write("<%= jsString %>");
mytext.document.write("</body>");
mytext.document.close();
mytext.document.designMode="On";
mytext.focus();
healBorders();
var theString = mytext.document.body.innerHTML;
alert(theString);
}
you can see that i've saved HTML code in a field in a db and upon loading this page i write it to the IFRAME using asp and javascript...
-------------
any help would be real, real nice.
b
i'm trying to do this:
var theString = mytext.document.body.innerHTML;
alert(theString);
where mytext is an IFRAME element...the only IFRAME element on the page...and although i keep getting the alert with the innerHTML in it exactly like i want (for a test)...i also get an error that says: object required.
now the interesting thing is that i've done this same thing other places in the app and it's worked fine! hmmm....
----------
my html looks like this:
<td><IFRAME class="mytext" width="<%= strWidth %>" ID="mytext" height="100%"></IFRAME></td>
and my javascript looks like this:
// Initialize everything when the document is ready
var YInitialized = false;
function document.onreadystatechange()
{
YInitialized = true;
var i, s, curr;
var newEvt;
mytext.document.open();
mytext.document.write("<BODY bgcolor=\"#<%= strColor %>\" >");
mytext.document.write("<%= jsString %>");
mytext.document.write("</body>");
mytext.document.close();
mytext.document.designMode="On";
mytext.focus();
healBorders();
var theString = mytext.document.body.innerHTML;
alert(theString);
}
you can see that i've saved HTML code in a field in a db and upon loading this page i write it to the IFRAME using asp and javascript...
-------------
any help would be real, real nice.
b