你没有写出你的代码,不好分析,你看看是不是缓存的问题?在main.jsp的<head>加入:
<meta http-equiv="expires" content="Mon, 06 Jan 1990 00:00:01 GMT">
<meta http-equiv="progma" content="no-cache">试试

解决方案 »

  1.   

    你没有写出你的代码,不好分析,你看看是不是缓存的问题?在main.jsp的<head>加入:
    <meta http-equiv="expires" content="Mon, 06 Jan 1990 00:00:01 GMT">
    <meta http-equiv="progma" content="no-cache">试试
      

  2.   

    这是init.html中的初始化代码:<script language="JavaScript">
    function init()
    {
    parent.private.document.open();
    parent.private.document.write("<html><head>");
    parent.private.document.write("<\script language=\"javascript\" src=\"javascript/changeTo.js\"></\script>");
             parent.private.document.write("<\LINK href=\"css/chat.css\" rel=stylesheet>");
    parent.private.document.write("<body>");
    parent.private.document.write("");
    parent.public.document.open();
    parent.public.document.write("<html><head>");
             parent.public.document.write("<\script language=\"javascript\" src=\"javascript/changeTo.js\"></\script>");
             parent.public.document.write("<\LINK href=\"css/chat.css\" rel=stylesheet>");
    parent.public.document.write("<body>");
    parent.public.document.write("");
    parent.public.document.bgColor="#ECFFFF";
             parent.private.document.bgColor="#ECFFFF";
             parent.hidden.location.href="refresh.jsp";//这里是负责向那两个帧中写入聊天信息的
    }
    </script>
    <title>init.htm</title>
    </head>
    <body onload="init()">
    </body>
    </html>
    若还需要其他代码的话请说,希望大家能帮忙看看到底是什么问题
      

  3.   

    主要是颜色显示问题,不是每次都按照
    parent.public.document.bgColor="#ECFFFF";
    parent.private.document.bgColor="#ECFFFF";
    所指定的显示,有时会显示成白色,但是当有聊天信息显示时它会显示成指定颜色
      

  4.   

    看看吧。<HTML>
    <HEAD>
    <script> function setIframe1()
     {
    iframe1.document.bgColor="red";
     }
     
     function wtIframe1()
     {
     // iframe1.document.open() 
     iframe1.document.write('aaaaa');
     }
    </script></HEAD><BODY>
    <iframe id=iframe1 width=100 height=100></iframe><br>
    <input type=button onclick="setIframe1()" value=set1>
    <input type=button onclick="wtIframe1()" value=show1><br>
    1.你先按"set1"然后按"show1",看到没有body的bgcolor被清除。<br>
    2.你先按"show1"然后再按"set1",在多次按"show1"<br>
    3.你把wtIframe1()的 iframe1.document.open()加上看看。<br>原因:所以你应该先用document.write('aa')写上东西。再设背景色。以后不要在用document.open.这样将清除bgcolor!!!
    解决:你只要一次用到open().甚至不要用。第一次用document.write,自然就open()了。然后再设bgcolor.
    </BODY>
    </HTML>
      

  5.   

    多谢lanbor了,我修改了init.html中的init()如下:
    parent.private.document.write("<html><head>");
    parent.private.document.write("<\script language=\"javascript\" src=\"javascript/changeTo.js\"></\script>");
    parent.private.document.write("<\LINK href=\"css/chat.css\" rel=stylesheet>");
    parent.private.document.write("<body>");
    parent.private.document.write("欢迎进入本聊天室<br>");
    parent.private.document.bgColor="#ECFFFF";
    parent.public.document.write("<html><head>");
        parent.public.document.write("<\script language=\"javascript\" src=\"javascript/changeTo.js\"></\script>");
        parent.public.document.write("<\LINK href=\"css/chat.css\" rel=stylesheet>");
    parent.public.document.write("<body>");
    parent.public.document.write("欢迎进入本聊天室<br>");
    parent.public.document.bgColor="#ECFFFF";
    但是现在有个问题,经过我多次测试,基本上能显示正确,在private帧里有时还有问题,这是怎么回事?另外我必须先用
    parent.public.document.write("欢迎进入本聊天室<br>");之后才能设置颜色(只有前面的那些不行),而且还不能用“”代替,必须写入内容才行,这是怎么回事?
    还有一个问题,我想让客户可以删除之前显示的消息那我就必须使用document.open()才行呀,有没有别的方法?
      

  6.   

    1)我必须先用parent.public.document.write("欢迎进入本聊天室<br>");之后才能设置颜色,而且还不能用“”代替:
      -->不会呀。你看我给你的例子子。在没有按“show1”之前不是“set1”不是也有用吗?2).我想让客户可以删除之前显示的消息那我就必须使用document.open()才行呀,有没有别的方法?
      -->document.open(); 之后加上 document.bgcolor= xxxx;3).其实颜色值更本没必要通过init.html来设什么背景。你把
    parent.private.document.write("<body>");改成 <body bgcolor=xxx>不就OK了吗?
    或者在document.open()或document.write().之后马上加上:document.bgcolor= xxxx;不也OK吗?
      

  7.   

    lanbor,对于问题1:如你所说,“原因:所以你应该先用document.write('aa')写上东西。再设背景色。”在你给我的例子中,如果我不是先按set1再按show1的话,在按了show1之后只要按set1颜色就会便白,而先按set1之后在按show1就没有这个问题了,但是问题是如果我先用document.write('aa')而aa是一些标签或者是head,title中内容的话却没有这个效果,只有写入一些可以显示的内容才行,而且写入“ ”也不行,这样我不得不写入一些没有必要的内容才行了。
    问题2:我的“清除”按钮触发的函数为:
    function init()

    parent.private.document.open();
    parent.private.document.write("<html><head>");
    parent.private.document.write("<\script language=\"javascript\" src=\"javascript/changeTo.js\"></\script>");
             parent.private.document.write("<\LINK href=\"css/chat.css\" rel=stylesheet>");
    parent.private.document.write("");//这里好像必须写入一点东西
    parent.private.document.write("<body bgColor=#ECFFFF>");
    parent.public.document.open();
    parent.public.document.write("<html><head>");
             parent.public.document.write("<\script language=\"javascript\" src=\"javascript/changeTo.js\"></\script>");
             parent.public.document.write("<\LINK href=\"css/chat.css\" rel=stylesheet>");
    parent.public.document.write("");//这里好像必须写入一点东西
    parent.public.document.write("<body bgColor=#ECFFFF>");
    现在问题就是我按了这个按钮后,颜色也经常不按照指定的出现。
    问题三:我没明白你的意思,我现在是想把private和public两个帧中加载的页面的颜色设置为某个颜色,不在init.html里加的话我没想到什么别的方式了,请赐教
      

  8.   

    将这四个文放在同一文件夹下。运行main.html你就什么都知道了。我还给你提供了一种更好的方法刷新页面:
    main.html
    ----------------------------------------------------------
    <html>
    <head>
    </head>
    <frameset rows="33%,33%,34%">
    <frame src="0.html" name="f0">
    <frame src="1.html" name="f1">
    <frame src="2.html" name="f2">
    </frameset>
    </html>0.html
    ----------------------------------------------------------------
    <html>
    <head>
    </head>
    <body>
    <script>
      parent.f0.document.write("<html><head><script><\/script><\/head><body bgcolor=red>");
      parent.f1.document.write("<html><head><script><\/script><\/head><body bgcolor=green>");
      //直接在body里写背景色。
    </script>
    </body>
    </html>1.html
    -------------------------------------------------------------------
    <html>
    <head>
    </head>
    <body>
    </body>
    </html>2.html
    ---------------------------------------------------------
    <html>
    <head>
    <script>
    var i = 0;
    function w0()
    {  //  建议用这种办法,不闪烁
       parent.f0.document.body.innerHTML = '<body bgcolor=red>';
       parent.f0.document.body.innerHTML += (i++) + '<br>';
     }function w1()
    {
       parent.f1.document.open();
       parent.f1.document.bgColor='green';
       parent.f1.document.write( (i++) + '<br>'); 
    }
    </script>
    </head>
    <body>
    <button onclick="setInterval(w0,1000)">定时写信息方法一(无闪烁)</button><br>
    <button onclick="setInterval(w1,1000)">定时写信息方法二</button>
    </body>
    </html>
      

  9.   

    两个问题:
    1。我把0.html中那段javascript删除后2.html中的w0就没有作用了呀,怎么回事?
    2。我在w0后只要加上一个
       parent.f0.document.write( )之后wo也不起作用了,这又是怎么回事?
      

  10.   

    1。我把0.html中那段javascript删除后2.html中的w0就没有作用了呀,怎么回事?你把0.html中那段javascript删除了。而这段javascript里面有<body>呀。你删了怎么用parent.f0.document.body呀!!!!????2。我在w0后只要加上一个
       parent.f0.document.write( )之后wo也不起作用了,这又是怎么回事?w0这种方法必须要用innerHTML来操作。不能用document.write了。对于w1()我相信很好的解决了你开始提出的问题。至于w0()的用法。你不熟悉就算了吧。用得也不普遍。 
      

  11.   

    对于w1我也有个问题,如果我把
    parent.f1.document.write( (i++) + '<br>'); 删除的话w1也不起作用了,怎么回事?另外w0的用法我的确不太熟悉,你能给我讲讲吗?
      

  12.   

    把parent.f1.document.write( (i++) + '<br>'); 删除了?????那不就没有输出代码了吗????那还显示什么呀????唉.在帖子上也讲不清,一帖来一帖去,不知道说到猴年马月.报上qq或msn.我告诉你吧.
      

  13.   

    我的qq是15051718,我现在不是要显示内容呀,只是要看到颜色变化罢了,把
    parent.f1.document.write( (i++) + '<br>'); 删除应该对前面的颜色设置没有影响吧?不会是之前的设置颜色的语句存在缓冲区内必须用下面这句才能输入缓冲区内容吧?