⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 js.js

📁 聊天程序
💻 JS
字号:
////////////////////////////////////////////////////////////////////////////////////////////////////////

function MM_reloadPage(init) {
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function MM_findObj(n, d) { 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_showHideLayers() {
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

////////////////////////////////////////////////////////////////////////////////////////////////////////


function ctlent(eventobject)
{
if(event.ctrlKey && window.event.keyCode==13)
	this.document.input.submit();
}

function check_output()
{
if(document.bgmFo.inited.value!="yes")
	{
	output.document.writeln("<link rel=\"stylesheet\" href=\"index.files/chat.css\" type=\"text/css\">");
	output.document.writeln("<!-- -- -- -- -- -- -- -- ------ -- -- -- -- -- -- !-->");
	output.document.writeln("<!-- -- -- -- -- -- check -- system -- -- -- -- -- !-->");
	output.document.writeln("<!-- -- -- -- -- -- -- -- ------ -- -- -- -- -- -- !-->");
	output.document.writeln("<font color=blue>正在检查您的浏览器状态 ...</blue><br>");
	output.document.writeln("<font color=blue>(如果没有反应,说明浏览器版本过低或JS解释器有问题 ...)</font><br>");
	output.document.writeln("<font color=blue>(画面停滞是因为正在读取图片,请耐心等待 ...)</font><br>");
	output.document.writeln("<font color=blue> .......................................... </font><br>");
	document.bgmFo.inited.value="yes";
	}
}
function addemot(src)
{
document.images.emots.src=src;
document.input.emot.value=src;
MM_showHideLayers('emotdiv','','hide');
if(document.input.ms.value=="s")  document.input.message.focus();
else  document.input.message2.focus();
}
function change_ms()
{
if(document.input.ms.value=="s")
	{
	MM_showHideLayers('msgdiv','','show');
	document.input.message2.value+=document.input.message.value;
	document.input.message.value="";
	document.images.ms.src="index.files/s.gif";
	document.input.ms.value="m";
	document.input.message2.focus();
	}
else
	{
	MM_showHideLayers('msgdiv','','hide');
	document.input.message.value+=document.input.message2.value;
	document.input.message2.value="";
	document.images.ms.src="index.files/m.gif";
	document.input.ms.value="s";
	document.input.message.focus();
	}
}
function showback()
{
chatback.background=document.bgmFo.backlist.options[document.bgmFo.backlist.selectedIndex].value;
if(document.input.ms.value=="s")  document.input.message.focus();
else  document.input.message2.focus();
}
function showadvance()
{
if(advance.style.display=="none")
	advance.style.display="";
else
	advance.style.display="none";
if(document.input.ms.value=="s")  document.input.message.focus();
else  document.input.message2.focus();
}
function toall()
{
document.input.obj.value="大家";
document.obj.obj_name.value="";
}
function set_timer()
{
if(document.input.timer.value=="0")
	return;
else
	{
	document.input.timer.value-=1;
	setTimeout('set_timer()',1000)
	}
}
function statu(stat)
{
if(stat=='sending')
	{
	if(document.input.timer.value!="0")
		{
		alert("不能在3秒内连续发言");
		return false;
		}
	if(document.input.message.value.replace(" ","")=="" && document.input.message2.value.replace(" ","")=="")
		{
		alert("你没有填写发言内容");
		return false;
		}
	document.images.status.src='index.files/sending.gif';
	//document.input.message.onfocus=document.input.message.blur();
	}
if(stat=='complete')
	document.images.status.src='index.files/complete.gif';
}
function change_div()
{
if(document.funtable.is_div.checked==false)
	div1.height="100%";
if(document.funtable.is_div.checked==true)
	div1.height="66%";	
if(document.input.ms.value=="s")  document.input.message.focus();
else  document.input.message2.focus();
}
function change_pri()
{
if(document.funtable.is_private.checked==false)
	{  document.input.pri.value="open"  ;  return;  }
if(document.funtable.is_private.checked==true)
	{
	if(document.input.priname.value=="")
		alert("提示:您的密谈列表为空,您发出的信息将无人接收");
	document.input.pri.value="private";
	return;
	}
if(document.input.ms.value=="s")  document.input.message.focus();
else  document.input.message2.focus();
}
function chaBGMAc22(foName,elName) 
{
if (document.all || document.getElementById || document.layers)
	{
	var p,v,emb;
	p=document.forms[foName].elements[elName];
	v=p.options[p.selectedIndex].value;
	if (v!="default")
		{
		emb='<embed src="'+v+'" hidden loop=true repeat=true autostart=true></embed>';
		writeAc22("BGM",emb);
		}
	}
}
function writeAc22(name,mes) 
{
if (document.all) document.all(name).innerHTML=mes;
else if (document.getElementById) document.getElementById(name).innerHTML=mes;
else if (document.layers)
	{
	document.layers[name].document.open();
	document.layers[name].document.write(mes);
	document.layers[name].document.close();
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -