- function addonline(name)
- {
- if ($(name)) return;
- var d1 = document.createelement("div");
- d1.id = name;
- d1.innerhtml = name;
- d1.classname = "online";
- $('div_online').appendchild(d1);
- }
- touchme();
- function check_send(e)
- {
- if (!e) e = window.event;
- var obj = $('chat_word');
- if (isie) obj.style.height = obj.scrollheight+3;
- if (e.keycode == 13)
- {
- if ((!e.shiftkey && !e.altkey && !e.ctrlkey) || !isie)
- {
- chat_send();
- obj.style.height = 20;
- return false;
- }
- else if (isie) obj.style.height = obj.scrollheight+18;
- }
- return true;
- }
- var send_ajax;
- send_ajax_change = function()
- {
- if (send_ajax.readystate == 4)
- {
- if (send_ajax.status != 200)
- {
- send_ajax_error();
- return;
- }
- if (debug) alert("send_ajax response:"+send_ajax.responsetext);
- if (send_ajax.responsetext.indexof("name")!=-1)
- {
- alert('已经有人使用你的昵称了');
- $('chat_user').value = "";
- $('chat_user').focus();
- }
- else if (send_ajax.responsetext.indexof("repeat")!=-1)
- {
- $('chat_word').value = window.lastcontent;
- }
- on_send_ok();
- if (!window.loading)
- {
- window.dotouch = true;
- load_word();
- }
- $('chat_word').disabled = false;
- $('chat_word').focus();
- }
- }
- function on_send_begin()
- {
- with($('chat_word'))
- {
- disabled = true;
- style.backgroundcolor = "#eeeeee";
- }
- window.sending = 1;
- }
- function on_send_ok()
- {
- window.sending = 0;
- with($('chat_word'))
- {
- value = '';
- disabled = false;
- focus();
- style.backgroundcolor = "#ffffff";
- }
- }
- function on_send_error()
- {
- window.sending = 0;
- with($('chat_word'))
- {
- disabled = false;
- focus();
- style.backgroundcolor = "#ffffff";
- }
- }
- function send_ajax_error()
- {
- alert('error 103nwhen send wordsnnyou can send them again!');
- $('chat_word').value = window.lastcontent;
- window.sending = 0;
- on_send_error();
- }
- function chat_send()
- {
- send_ajax = createajax();
- send_ajax.open('post','<?php echo basename(__file__);?>',true);
- send_ajax.setrequestheader("content-type", "application/x-www-form-urlencoded");
- send_ajax.onreadystatechange = send_ajax_change;
- var urlstring = '';
- var name = $('chat_user').value.replace("n","");
- var content = $('chat_word').value;
- var bold = ($('input_bold').checked)?"bold":"";
- var size = parseint($('input_size').value);
- var font = $('input_font').value;
- if (name == "")
- {
- alert('please enter your nick name first!!');
- $('chat_user').focus();
- return;
- }
- if (content == "" || content == "n" || content == "nn" || content == "nnn")
- {
- alert('please enter your words!');
- $('chat_word').focus();
- $('chat_word').value = "";
- return;
- }
- if (size>100) size = 100;
- else if (size<0) size = 1;
- urlstring+= "action=write";
- urlstring+= "&name="+encode(name);
- urlstring+= "&content="+encode(content);
- urlstring+= "&bold="+bold;
- urlstring+= "&color="+window.color;
- urlstring+= "&size="+size;
- urlstring+= "&font="+font;
- urlstring+= "&room="+room;
- window.sending = 1;
- window.lastcontent = content;
- on_send_begin();
- if (debug) alert("sending:"+urlstring);
- send_ajax.send(urlstring);
- settimeout("if (window.sending) send_ajax.abort(); on_send_error();",5000);
- setcookie("chatusername",$('chat_user').value);
- }
- function resize(s)
- {
- var o = $('div_contents').style;
- var h = parseint(o.height);
- h = (s)?h+50:h-50;
- if (h<=50 || h>=3000) return;
- o.height = h;
- $('div_contents').scrolltop = 655350;
- }
- function clearall()
- {
- $('div_contents').innerhtml = "";
- }
- </script>
- </center>
- </body>
- </html>
- <?php
- }
- ?>
新闻热点
疑难解答