日期:2014-05-18  浏览次数:20671 次

怎么将.js文件中获得的颜色变量值传给.jsp中的变量?????
<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,但怎么会不行呢?求教各位高手解决,只要解决了,就送分。

------解决方案--------------------
js无法直接与jsp相互传递变量。
java有获取背景颜色的函数吧。
------解决方案--------------------
“IframeID.document.bgColor”是editor.js 里面的一个存放颜色值的变量,这个说法有问题吧. 你的IframeID.document.bgColor在editor.js 是什么?
你可以用CSS.专门控制显示格式的,把合适信息写在CSS文件里面.