SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    need help changing background color of an iframe

    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!
    Code:
    <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" width=800 height=45 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=1 scrolling=no ></iframe></td>
    exfilejs.cfm:
    Code:
    <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>

    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.
    }

  2. #2
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Shaggy,

    allowtransparency


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •