<script language="javascript" src="editor_full/editor.js"></scrip>
   <script language="javascript" >
 var a=document.getElementById('TT1');
         
a.style.backgroundColor="IframeID.document.bgColor";
             
    </script>    
这段代码是在a.jsp文件中,这个“IframeID.document.bgColor”是editor.js 里面的一个存放颜色值的变量,整段代码想要达到的目的是从editor.js里读取IframeID.document.bgColor并将它赋值给a.style.backgroundColor,但怎么会不行呢?求教各位高手解决,只要解决了,就送分。

解决方案 »

  1.   

    js无法直接与jsp相互传递变量。
    java有获取背景颜色的函数吧。
      

  2.   

    “IframeID.document.bgColor”是editor.js 里面的一个存放颜色值的变量,这个说法有问题吧. 你的IframeID.document.bgColor在editor.js 是什么?
    你可以用CSS.专门控制显示格式的,把合适信息写在CSS文件里面.
      

  3.   

    IframeID.document.bgColor在editor.js 里的作用是给iframe框架显示背景色,我就想把这个背景色也能够显示到table的背景里面,不知道怎么办?