bombshell(水中鱼)   1725(1725)
如何在js中实现?
比如点击发送按钮时刷新。怎样用函数实现submit功能?
麻烦您详细说一下, 谢谢 :)

解决方案 »

  1.   

    做一个刷新页面的函数,当点击SUBMIT 的时候执行函数就可以了。
      

  2.   

    用帧和JAVASCRIPT共同实现。用户列表和发言区位于不同的帧中。由JAVASCRIPT或<meta>标记控制页面刷新
      

  3.   

    xuzuning(唠叨)  
     我不清楚帧的概念  我写的聊天室主界面是分三个frame的,
     左边的frame显示的是用户的信息,右边上面的frame(message.php)显示的是用户聊天的信息,
     右下是用户发言的功能区. 
     我把发言的程序帖出来,麻烦你帮我看看怎么改,非常感谢!
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    /* <meta http-equiv="Refresh" content="<?print($refreshtime);?>; URL=input1.php?
    <?print("nickname=$nickname&refreshtime=15sec&recordcnt=$recordcnt");?>">  */
    <title></title>
    <base target="message">
    </head>
    <body style="font-family:Arial;font-size:8pt;color:rgb(0,0,128)" bgcolor="99CCFF">
    <form name=post method="post" action="message1.php?
    <? print("nickname=$nickname&refreshtime=$refreshtime&recordcnt=$recordcnt");?>">
    <table border="0" cellpadding="0" cellspacing="0" width="100%" height="128" bgcolor="99CCFF">
    <tr>
    <td width="100%" height="15">请选择您的表情:</td>
    </tr>
    <tr>
    <td width="100%" height="25">
    <input type="radio" value="1" checked name="emoteindex">
    <img src="emote1.gif" width="15" height="15" alt="今天心情不错!">&nbsp;
    <input type="radio" value="2" name="emoteindex">
    <img src="emote2.gif" width="15" height="15" alt="呵呵!">&nbsp;
    <input type="radio" value="3" name="emoteindex">
    <img src="emote3.gif" width="15" height="15" alt="讨厌!">&nbsp;
    <input type="radio" value="4" name="emoteindex">
    <img src="emote4.gif" width="15" height="15" alt="我该怎么办?">&nbsp;
    <input type="radio" value="5" name="emoteindex">
    <img src="emote5.gif" width="15" height="15" alt="怎么样!">&nbsp;
    <input type="radio" value="6" name="emoteindex">
    <img src="emote6.gif" width="15" height="15" alt="随便说说.">&nbsp;
    <input type="radio" value="7" name="emoteindex">
    <img src="emote7.gif" width="15" height="15" alt="靠.">&nbsp;
    <input type="radio" value="8" name="emoteindex">
    <img src="emote8.gif" width="15" height="15" alt="哼!气死我了!">
    </td>
    </tr>
    <tr>
    <td width="100%" height="15"><br>
    <SELECT name="mood" class=myBlack>                                  
            <OPTION value="无表情"                                               
            <? if($mood=="无表情") echo "selected";?>                         
            >无表情</OPTION>                                                     
            <OPTION value="微笑"                                               
            <? if($mood=="微笑") echo "selected";?>                         
            >微笑</OPTION>                                                                                          
            <OPTION value="柔声"                                                 
             <? if($mood=="柔声") echo "selected";?>                          
             >柔声</OPTION>                                                      
            <OPTION value="深情"                                                 
             <? if($mood=="深情") echo "selected";?>                          
             >深情</OPTION>                                                      
            <OPTION value="惋惜"                                                 
            <? if($mood=="惋惜") echo "selected";?>                           
            >惋惜</OPTION>                                                       
            <OPTION value="沉思"                                                 
             <? if($mood=="沉思") echo "selected";?>                          
             >沉思</OPTION>  
            <OPTION value="惊讶"                                                 
             <? if($mood=="惊讶") echo "selected";?>                          
             >惊讶</OPTION>       
            <OPTION value="凶狠"                                                 
             <? if($mood=="凶狠") echo "selected";?>                          
             >凶狠</OPTION>  
             <OPTION value="兴高采烈"                                             
            <? if($mood=="兴高采烈") echo "selected";?>                       
            >兴高采烈</OPTION>                                                   
            <OPTION value="大惑不解"                                             
            <? if($mood=="大惑不解") echo "selected";?>                       
            >大惑不解</OPTION>                                                             
          </SELECT>                                                              
                                                                                 
      

  4.   

    地 对                                                               
                                                                                 
          <SELECT name="person" class=myBlack>                                                                             
            <OPTION value="全部的人"                                             
              <? if($person=="全部的人")                                      
                  echo "selected";?>                                             
            >                                                                    
            全部的人                                                             
            </OPTION>                  
            <?                                                                   
            //取出在线的名单      
            $mysql_db=mysql_connect("localhost","root","");
            mysql_select_db("chatroom",$mysql_db);                                               
            $sql = "SELECT * from users";                               
            $sql_result = mysql_query($sql);                             
           
           // 使用WHILE循环来显示在线名单   每次循环显示一个在线用户                                
            while ($sql_row=mysql_fetch_row($sql_result))                         
            {                                                                    
             // $name_now=$sql_row[person];  
            if($nickname!=$sql_row[0]) 
    {                                             
              echo "<OPTION value=";
              printf($sql_row[0]);                                                    
                                                      
                   // echo "selected";                                           
              echo ">".$sql_row[0]."</OPTION>"; 
    }                                   
            }                                                                    
            ?>                                                                   
            </SELECT>                                                            
              说道:              
    <input type="text" name="message" size="50">&nbsp;&nbsp;
    您喜欢的颜色
    <SELECT name="color" class=myBlack>                                 
            <OPTION value="#FF3366"                                                  
                    <? if($color=="#FF3366") echo "selected";?>>                   
            红色</OPTION>                                                       
            <OPTION value="purple"                                               
                    <? if($color=="purple") echo "selected";?>>             
            紫色</OPTION>                                                       
            <OPTION value="Fuchsia"                                              
            <? if($color=="Fuchsia") echo "selected";?>>                      
            紫红色</OPTION>                                                     
            <OPTION value="black"                                                
                    <? if($color=="black") echo "selected";?>>                 
            黑色</OPTION>                                                       
            <OPTION value="#33CC66"                                                
            <? if($color=="#33CC66") echo "selected";?>>                         
            绿色</OPTION>                                                       
            <OPTION value="Aqua"                                                 
            <? if($color=="Aqua") echo "selected";?>>                          
            浅绿色</OPTION>                                                     
            <OPTION value="#FFFF33"                                               
             <? if($color=="#FFFF33") echo "selected";?>>                       
             黄色</OPTION>                                                      
            <OPTION value="#009CFF"                                                 
             <? if($color=="#009CFF") echo "selected";?>>                         
            蓝色</OPTION>                                                       
          </SELECT>
     <input type="submit" value="我要发言" name="talk">
    <input type="reset" value="清空" name="reset">
    <?print("<br>\n");
    print("<br>\n");
    print("<br>\n");?>
    </td>
    </tr>
    </table>
    <br></br>
    <br></br>
    </form>
    </body>
    </html>
    (由于程序长,我分了两个回复写)
      

  5.   

    把显示在线用户下拉框放在左边的frame中
    因为左边的frame显示的是用户的信息,所以加上在线用户不会有影响
    同时在左边的frame加入定时刷新
      

  6.   

    xuzuning(唠叨)
    谢谢 :) 
    那message.php就要从两个frame中接受参数?
    可以这样吗?