Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 6081 | Replies: 1
![]() |
•
•
Join Date: Dec 2006
Posts: 5
Reputation:
Rep Power: 0
Solved Threads: 0
I do not much understand what is going on. The iframe is transparent in all browsers but IE. I need to change the background color in IE, of my iframe and cannot figure it out. My code is below. It is pulling from an external file exfile.js. Nothing i have tried will change the background color, HELP!
exfilejs.cfm
can I use this function somehow to change the background color??
function change_background() {
document.frames.tickermain.document.body.style.backgroundColor="#ccff6";
// use the frames collection to access the document contained in the IFRAME.
}
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#F9F7C3">
<!-- ImageReady Slices (POAHome.psd) -->
<table id="Table_01" width="800" height="601" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td colspan="3">
<a href="index.cfm"><img src="images/POAHome_01.gif" alt="" width="435" height="200" border="0" usemap="#Map"></a></td>
<td colspan="3">
<img src="images/POAHome_02.gif" width="365" height="200" alt=""></td>
<tr>
<td colspan="6"><iframe id="tickermain" src="exfilejs.cfm<script language='JavaScript1.2'>
//IFRAME TICKER- By Dynamic Drive (http://www.dynamicdrive.com)
//configure delay between changing messages (3000=3 seconds)
var delay=3000
var ie4=document.all
var curindex=0
var totalcontent=0
function get_total(){
if (ie4){
while (eval('document.all.content'+totalcontent))
totalcontent++
}
else{
while (document.getElementById('content'+totalcontent))
totalcontent++
}
}
function contract_all(){
for (y=0;y<totalcontent;y++){
if (ie4)
eval('document.all.content'+y).style.display='none'
else
document.getElementById('content'+y).style.display='none'
}
}
function expand_one(which){
contract_all()
if (ie4)
eval('document.all.content'+which).style.display=''
else
document.getElementById('content'+which).style.display=''
}
function rotate_content(){
get_total()
contract_all()
expand_one(curindex)
curindex=(curindex<totalcontent-1)? curindex+1: 0
setTimeout('rotate_content()',delay)
}
window.onload=rotate_content
</script>
<body>
<div id='content0' style='display:none;backgroundColor:"#ccff6"'>
<cfoutput query='getinfo'>
#thedesc#
</div>
<div id='content1' >
#thedesc2#
</div>
<div id='content2' style='display:none'>
</div>
</cfoutput>
</body>
</html>function change_background() {
document.frames.tickermain.document.body.style.backgroundColor="#ccff6";
// use the frames collection to access the document contained in the IFRAME.
}
•
•
Join Date: Mar 2007
Posts: 83
Reputation:
Rep Power: 0
Solved Threads: 2
OK, I am hoping your code above is broken because of the way you copied it.... BUT... IE defaults a webpage to a white background... Body tag's background is NOT an inherited value... other browsers make everything or almost everything an inherited value... who's right, who's wrong according to the standard... it doesn't matter...
Your included document need to set the background color for the body tag... Then it will be included in the iframe with that color... if you make 1 CSS that is common to both pages, and set a class to use your desired color and then set the parent document's div or table or cell or whever AND the the included documents body tag to be that class... problem is solved...
You can also just alter the CSS for background-color for the body tag if you want the whole page altered... The use the same CSS for both pages and you only change 1 place to change them all...
You can use javascript to set the color but again, set the body tags background-color CSS property for the included document...
The iframe takes the color of the included documents <body> tag... so this should be a good place for you to start...
Your included document need to set the background color for the body tag... Then it will be included in the iframe with that color... if you make 1 CSS that is common to both pages, and set a class to use your desired color and then set the parent document's div or table or cell or whever AND the the included documents body tag to be that class... problem is solved...
You can also just alter the CSS for background-color for the body tag if you want the whole page altered... The use the same CSS for both pages and you only change 1 place to change them all...
You can use javascript to set the color but again, set the body tags background-color CSS property for the included document...
The iframe takes the color of the included documents <body> tag... so this should be a good place for you to start...
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)





Linear Mode