Hello,
I have several iframes and I want each iframe to have a different background
color.
My source code is at the end.
When I set the background color of one html-iframe, the background color of
every iframe changes.
Now I wonder whether all iframes have the same iframeID.
(I am using OpenLaszlo version 4.1.1)
Kind Regards,
Marc
------
<canvas height="1000" width="1000">
<view width="210" height="210" bgcolor="0xDDDDDD">
<html width="200" height="200" y="5" x="5" id="myHTML1"/>
</view>
<view width="210" height="210" x="250" bgcolor="0xDDDDDD">
<html width="200" height="200" y="5" x="5" id="myHTML2"/>
</view>
<!-- work around for Bug LPP-6911: -->
<method name="_setIframeContent" args="iframeID, content, backgroundColor"
><![CDATA[
var js;
Debug.write("display with background color = "+backgroundColor);
js = "window.__seticontent = function (iframeID, content)
{document.getElementById(iframeID).contentWindow.document.body.innerHTML=content;"
+
"document.getElementById(iframeID).contentWindow.document.body.style.backgroundColor=\""+backgroundColor+"\";
}";
if ($dhtml) {
//LPP-6911
eval(js);
} else {
LzBrowserService.LzBrowser.loadJS(js);
}
LzBrowserService.LzBrowser.callJS("window.__seticontent", false,
iframeID, content);
]]>
</method>
<button name="myButton" width="100" height="100" x="550" text="fill
iframes">
<handler name="onclick"><![CDATA[
/* fill first iframe with content */
var myHTML =
"<HTML><HEAD></HEAD><BODY>Hello</BODY></HTML>";
Debug.write("html content (1) = "+ myHTML);
var theiframeID = myHTML1.iframeid;
//parent._setIframeContent(theiframeID, myHTML,
"yellow");
parent._setIframeContent(theiframeID, myHTML, "green");
/* fill second iframe with content*/
myHTML = "<HTML><HEAD></HEAD><BODY>Ciao</BODY></HTML>";
Debug.write("html content (2) = "+ myHTML);
theiframeID = myHTML2.iframeid;
//parent._setIframeContent(theiframeID, myHTML,
"green");
parent._setIframeContent(theiframeID, myHTML, "yellow");
]]>
</handler>
</button>
</canvas>