[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Background color problem with dynamic XSL


Subject: RE: [xsl] Background color problem with dynamic XSL
From: richard.whitley@xxxxxxxxxxxx
Date: Mon, 16 Jul 2001 14:00:31 -0700

> 
> Date: Mon, 16 Jul 2001 13:20:56 -0400
> From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
> Subject: Re: [xsl] Background color problem with dynamic XSL 
> transformations
> 
> [Kevin Nardi]
> >
> >
> > >I've noticed that IE interprets HTML differently depending 
> on whether it
> is
> > >static or dynamic.  The dynamic HTML seems to be 
> interpreted much more
> > >strictly.  Try "silver" instead of "Silver", or if that 
> doesn't work, try
> a
> > >hexidecimal value.
> > >
> 
> How are you trying to change the bgcolor dynamically, and 
> what object are
> you trying to change the color of?
> 
> When I change the bgcolor of the document, I can only change 
> it during the
> onload event, otherwise the new color flashes for a second 
> and then goes
> away.  However, If I set it in the onload event, I do get 
> silver when I ask
> for 'silver'.  I got the same behavior on IE5.5, NS4.73, and NS 6.1.
> 
> Here's what I did:
> 
> <html>
> <head>
> <script language='javascript'>
> 
> function changecolor(){
>  document.bgColor='silver'
> }
> 
> </script>
> </head>
> 
> <body onload='changecolor()'>
> <h3>This is a test of dynamically setting the document bgcolor</h3>
> 
> </body>
> </html>
> 
> Tom P
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> ------------------------------
> 

Thanks for the idea, Tom.  Even this doesn't work for me (in IE 5.5.)  I'm now really curious for why it works for you, but not for me.  What OS are you using?  I'm on NT 4.0.  

In addition to calling the internal script from the onload event, as you did, I also tried setting the property from within the external JS file that creates the page.  Here's what I used:

	...
	var xslDoc = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
	var xmlDoc = new ActiveXObject("MSXML2.DOMDocument");

	xslDoc.async = false;
	xslDoc.load(xslFile);

	xmlDoc.async = true;
	xmlDoc.load(xmlFile);

	var tem = new ActiveXObject("MSXML2.XSLTemplate")
	tem.stylesheet = xslDoc;
	var proc = tem.createProcessor();
	proc.addParameter(paramName, paramVal); 
	proc.input = xmlDoc;
	proc.transform();
	var str = proc.output;
	alert(str);
	top.rightTop.document.write(str);
	top.rightTop.document.close();
	top.rightTop.document.bgColor = "silver";
	...

I tried changing bgColor both before and after I call close on the document object.  It doesn't work either way.  Of course, I removed the onload event handler from the BODY element in the XSLT before trying this.

Thanks again for your help.

-Richard

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords