} content.scrollTop=content.scrollHeight; } //--------------------------------------------- //强制关闭 function closeWindow(){ window.opener=null;window.close(); } if (document.getElementById){ ( function(){ if (window.opera){ document.write("<input type='hidden' id='Q' value=' '>"); }
var n = 500; var dragok = false; var y,x,d,dy,dx;
function move(e) { if (!e) e = window.event; if (dragok){ d.style.left = dx + e.clientX - x + "px"; d.style.top = dy + e.clientY - y + "px"; return false; } }
function down(e){ if (!e) e = window.event; var temp = (typeof e.target != "undefined")?e.target:e.srcElement; if (temp.tagName != "HTML"|"BODY" && temp.className != "dragclass"){ temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement; } if('TR'==temp.tagName){ temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement; temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement; temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement; }
if (temp.className == "dragclass"){ if (window.opera){ document.getElementById("Q").focus(); } dragok = true; temp.style.zIndex = n++; d = temp; dx = parseInt(gs2(temp,"left"))|0; dy = parseInt(gs2(temp,"top"))|0; x = e.clientX; y = e.clientY; document.onmousemove = move; return false; } }
function up(){ dragok = false; document.onmousemove = null; }
非常感谢上楼的回复.但是我感觉你的职业应该是律师之类的.至少不适合做程序员吧..抠字眼很厉害,至于其他的不怎么样的...呵呵
哪个程序员会把和聊天相关的信息存在Session中?湖南移动的客户,不说多的,几千万应有吧..把聊天的相关信息存在服务器Session中,,应该不合适吧?有可能会爆炸哦!哈哈
brush.html<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>brush.html</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="brush.js"></script>
<link rel="stylesheet" href="brush.css" type="text/css"></link>
</head>
<body onload="textFocus()">
<div class="dragclass" id="main" style="LEFT: 100px; TOP: 100px">
<div id="ChatHead" style="font-size:16px;"><a onclick="ChatHidden();" href="#"><string>-</a> <a onclick="ChatShow();" href="#">+</a> <a onclick="ChatClose();" href="http://user.qzone.qq.com/366688648?ptlang=2052&ADUIN=596661332&ADSESSION=1320406658&ADTAG=CLIENT.QQ.3493_FriendFolder_QuickMenu.0">X</a> </div></string>
<div id="ChatBody">
<div id="ChatContent"></div>
<div id="ChatBtn">
<form action="" method="post" name="chat">
<textarea style="WIDTH: 350px" rows="3" id="ChatValue" onblur="this.focus()" name="ChatValue">知识改变命运,教育改变生活.</textarea><br/>
<input onclick="ChatSend(this.form);" type="button" name="Submit" value="发 送" />
</form>
</div>
</div>
</div>
</body>
</html>
brush.css body {
text-align:left;
margin:0;
font:normal 12px Verdana, Arial;
background:#FFEEFF
}
form {
margin:0;
font:normal 12px Verdana, Arial;
}
table,input {
font:normal 12px Verdana, Arial;
}
a:link,a:visited{
text-decoration:none;
color:#333333;
}
a:hover{
text-decoration:none;
color:#FF6600
}
#main {
width:400px;
position:absolute;
left:600px;
top:100px;
background:#EFEFFF;
text-align:left;
filter:Alpha(opacity=90)
}
#ChatHead {
text-align:right;
padding:3px;
border:1px solid #003399;
background:#DCDCFF;
font-size:11px;
color:#3366FF;
cursor:move;
}
#ChatHead a:link,#ChatHead a:visited, {
font-size:14px;
font-weight:bold;
padding:0 3px
}
#ChatBody {
border:1px solid #003399;
border-top:none;
padding:2px;
}
#ChatContent {
height:200px;
padding:6px;
overflow-y:scroll;
word-break: break-all
}
#ChatBtn {
border-top:1px solid #003399;
padding:2px
}brush.js
function $(d){return document.getElementById(d);}
function gs(d){var t=$(d);if (t){return t.style;}else{return null;}}
function gs2(d,a){
if (d.currentStyle){
var curVal=d.currentStyle[a]
}else{
var curVal=document.defaultView.getComputedStyle(d, null)[a]
}
return curVal;
}
function ChatHidden(){gs("ChatBody").display = "none";}
function ChatShow(){gs("ChatBody").display = "";}
function ChatClose(){gs("main").display = "none";}
var msg="";
function init(){
msg =$("ChatValue").value;
}
function textFocus(){
$("ChatValue").focus();
}
var msgNum=0;//相同消息数
var msgNum2=0;//监控发送消息数
var fristTime;//监控第一次发消息时间
var lastTime;//监控最后一次发消息时间
var brushNum=0;//刷屏数
//发送
function ChatSend(obj){
var o = obj.ChatValue;
var content=$("ChatContent");
if (o.value.length>0&&o.value!=''){
content.innerHTML += "<strong>you说:</strong>"+o.value+"<br/><br/>";
if(o.value==msg){
msgNum++;
}else{
init();
msgNum=0;
}if(msgNum>=3){
msgNum=0;
msg="";
brushNum++;
content.innerHTML += "<strong style='color:red;'>系统警告"+brushNum+"次:</strong><font style='color:red;'>请不要发送相同的消息!警告累计4次后系统将强行终止会话!</font><br/><br/>";
}
if(msgNum2==0){
fristTime=new Date();
}
msgNum2++;
if(msgNum2>=10){
lastTime=new Date();
msgNum2=0;
if(lastTime-fristTime<=10*1000){
brushNum++;
content.innerHTML += "<strong style='color:red;'>系统警告"+brushNum+"次:</strong><font style='color:red;'>您说话太快了!警告累计4次后系统将强行终止会话!</font><br/><br/>";
}
}
if(brushNum>=4){
confirm("对不起,因为您存在刷屏行为,已被系统列入黑名单。");
closeWindow();
}
o.value='';
}
content.scrollTop=content.scrollHeight;
}
//---------------------------------------------
//强制关闭
function closeWindow(){
window.opener=null;window.close();
}
if (document.getElementById){
(
function(){
if (window.opera){ document.write("<input type='hidden' id='Q' value=' '>"); }
var n = 500;
var dragok = false;
var y,x,d,dy,dx;
function move(e)
{
if (!e) e = window.event;
if (dragok){
d.style.left = dx + e.clientX - x + "px";
d.style.top = dy + e.clientY - y + "px";
return false;
}
}
function down(e){
if (!e) e = window.event;
var temp = (typeof e.target != "undefined")?e.target:e.srcElement;
if (temp.tagName != "HTML"|"BODY" && temp.className != "dragclass"){
temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement;
}
if('TR'==temp.tagName){
temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement;
temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement;
temp = (typeof temp.parentNode != "undefined")?temp.parentNode:temp.parentElement;
}
if (temp.className == "dragclass"){
if (window.opera){ document.getElementById("Q").focus(); }
dragok = true;
temp.style.zIndex = n++;
d = temp;
dx = parseInt(gs2(temp,"left"))|0;
dy = parseInt(gs2(temp,"top"))|0;
x = e.clientX;
y = e.clientY;
document.onmousemove = move;
return false;
}
}
function up(){
dragok = false;
document.onmousemove = null;
}
document.onmousedown = down;
document.onmouseup = up;
}
)();
}