作者sunny6175 (你好不代表我也好)
站內Web_Design
標題[問題] asp.net
時間Mon Nov 28 23:00:56 2005
我要建立一個聊天室的表單
主要功能都建好了
可是若是要新增一個下拉式選單 ex: zzz"微笑"的說 or "生氣"的說
並沒辦法跑到聊天視窗中
請問我該在我程式中增加哪段
<font size="2" color="#000000">語氣:</font>
<asp:DropDownList id="cc" runat="Server">
<asp:ListItem Value="1" Text="高興"/>
<asp:ListItem Value="2" Text="難過"/>
<asp:ListItem Value="3" Text="生氣"/>
<asp:ListItem Value="4" Text="怒氣"/>
<asp:ListItem Value="5" Text="想睡"/>
<asp:ListItem Value="6" Text="不舒服"/>
</asp:DropDownList>
</td>
<td width="132" valign="top">
<font size="2" color="#000000">更新頻率:</font>
<asp:DropDownList id="Refresh_s" runat="Server">
<asp:ListItem Value="10" Text="10秒"/>
<asp:ListItem Value="20" Text="20秒"/>
<asp:ListItem Value="30" Text="30秒"/>
</asp:DropDownList>
</td>
<td width="132" valign="top">
<font size="2" color="#000000">顏色:</font>
<asp:DropDownList id="f_color" runat="Server">
<asp:ListItem Value="#FF0000" Text="紅色"/>
<asp:ListItem Value="#FFFF00" Text="黃色"/>
<asp:ListItem Value="#00FF00" Text="綠色"/>
<asp:ListItem Value="#FFFFFF" Text="白色"/>
<asp:ListItem Value="BLUE" Text="藍色"/>
<asp:ListItem Value="#FF6633" Text="橘色"/>
</asp:DropDownList>
</td>
<td width="129">
<asp:Button runat="server" Text="送出" OnClick="addmsg_click" />
</td>
</tr>
</table>
</Form>
</body>
</html>
<script language="VB" runat=server>
Sub addmsg_click(sender As Object, e As EventArgs)
Session("RefreshTime") = Refresh_s.SelectedItem.Value
Session("font_color") = f_color.SelectedItem.Value
If Application("ChatUser").ContainsKey ( Session("user_id") ) Then
Dim chat_data As ArrayList
chat_data = Application("ChatUser").Item( Session("user_id") )
Dim path As String = Server.Mappath("talkfile/" & chat_data(0) & ".txt")
Dim sWrite As StreamWriter = New StreamWriter( path, True, Encoding.Default )
Dim S As string
S = "<font size=3 color=" & Session("font_color") & "><small>(" & DateTime.Now & ")</small> " & Session("user_id") & "</small> " & Session("UserSay") & " 說:<font color=" & Session("font_color") & ">" & chatmsg.Text & "</font></font><br>"
chat_data(4) = DateTime.Now()
Application("ChatUser").Item( Session("user_id") ) = chat_data
sWrite.WriteLine( S ) ' 寫入檔案
sWrite.Flush() ' 將緩衝區寫入
sWrite.Close()
chatmsg.Text=""
Else
chatmsg.Text = "請重新登入聊天室"
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 211.74.213.174