W
William Starr Moake
For an IE-based offline WYSIWYG editor I'm developing, I have added
javascript to insert images as table backgrounds and to set page
background color. But I can't get any script to work for setting a
page background image.
I use a form with a button input type="file" for the user to select a
page background image from his hard drive and a second button with
onClick to launch this script:
function backImg() {
var img = form2.imgurl.value;
var body = "<BODY style='background:" + img + "'>";
iView.focus();
iView.document.write(body);
}
But I get this HTML when the page is saved:
<BODY style="BACKGROUND: none"></BODY>
The MSHTML control is ignoring the var img input and it doesn't allow
access to the <head> section for CSS input. I've tried dozens of
variations of the script, but none work. Any ideas?
PS: I have to use BODY style= rather than body background= because
it's proprietary in MSHTML.
javascript to insert images as table backgrounds and to set page
background color. But I can't get any script to work for setting a
page background image.
I use a form with a button input type="file" for the user to select a
page background image from his hard drive and a second button with
onClick to launch this script:
function backImg() {
var img = form2.imgurl.value;
var body = "<BODY style='background:" + img + "'>";
iView.focus();
iView.document.write(body);
}
But I get this HTML when the page is saved:
<BODY style="BACKGROUND: none"></BODY>
The MSHTML control is ignoring the var img input and it doesn't allow
access to the <head> section for CSS input. I've tried dozens of
variations of the script, but none work. Any ideas?
PS: I have to use BODY style= rather than body background= because
it's proprietary in MSHTML.