top
Loading...
聊天室技術(二)--登錄
1 頁面登陸的基本要素
你可以在我的竹葉看到登陸的表單,這里提供了最基本的登陸表單項
(1)登陸表單
<form method=POST name=chatform action=chat/login.php?action=enter onSubmit="b1_submit();return true;" target="howtodo">
(a)聊天表單的名字為chatform,我使用action=enter作為進入聊天室的入口,如果沒有這個參數,則顯示登陸頁面.
(b)在表單提交時,先調用b1_submit()建立聊天的窗口
(c)聊天的目標窗口為b1_submit()建立的howtodo窗口

(2)表單項
昵稱:<input type=text name=name size=15 maxlength="10">
密碼:<input type=password name=pass size=15 maxlength="10">
<input type=submit name=submit value=登陸 style="width:100">
<input type=reset name=reset value=重添 style="width:50">
(a)各表單項一定要設定最大允許長度 maxlength

(3)建立聊天窗口的js
<script LANGUAGE="javascript">
function b1_submit(){
chat=window.open('',"howtodo",'Status=no,scrollbars=no,resizable=no');

chat.moveTo(0,0);
chat.resizeTo(screen.availWidth,screen.availHeight);
chat.outerWidth=screen.availWidth;
chat.outerHeight=screen.availHeight;
}
這段代碼先打開一個沒有狀態欄,滾動條,可調整尺寸的howtodo窗口!然后移動到屏幕左上角,然后放大到允許的屏幕大小.

原作者:howtodo
來源:php2000.com

北斗有巢氏 有巢氏北斗