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

📄 function.js

📁 本系统是一套开源WEB的网站管理系统
💻 JS
字号:
		function changeimage()
		{
			//document.addgb.GuestImages.value=document.addgb.Imageface.value;
			document.myform.imageface.src='images/Face/'+document.myform.gb_face.value+'.gif';
		}
function gbcount(message,total,used,remain)
	{
		var max;
		max = total.value;
		if (message.value.length > max) {
			message.value = message.value.substring(0,max);
			used.value = max;
			remain.value = 0;
			alert("留言不能超过" +max+ "个字!");
			}
			else {
			used.value = message.value.length;
			remain.value = max - used.value;
			}
	}
// 新闻、文章的字体大小改变函数
function ContentSize(size)
{
var obj=document.getElementById("size");
obj.style.fontSize=size+"px";
}
// 新闻、文章的复制文本函数
function copyText(obj) 
{
var rng = document.body.createTextRange();
rng.moveToElementText(obj);rng.scrollIntoView();
rng.select();rng.execCommand("Copy");
rng.collapse(false);
}
// 图片缩放脚本
var flag=true; 
function DrawImage(ImgD){ 
    var image=new Image(); 
    image.src=ImgD.src; 
    if(image.width>0 && image.height>0){ 
        flag=true; 
        if(image.width>=750){ 
            ImgD.width=750; 
            ImgD.height=(image.height*750)/image.width; 
        }else{ 
            ImgD.width=image.width; 
            ImgD.height=image.height; 
        }  
    } 
}
function gbDrawImage(ImgD){ 
    var image=new Image(); 
    image.src=ImgD.src; 
    if(image.width>0 && image.height>0){ 
        flag=true; 
        if(image.width>=135){ 
            ImgD.width=135; 
            ImgD.height=(image.height*135)/image.width; 
        }else{ 
            ImgD.width=image.width; 
            ImgD.height=image.height; 
        }  
    } 
} 
function cgimg(o){
var zoom=parseInt(o.style.zoom, 10)||100;zoom+=event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom+'%';
return false;
}

function runCode(obj)
{
    ie = (document.all)? true:false
    if (ie)
    {
        var code=obj.innerText;//即要运行的代码。
        var newwin=window.open('','','');  //打开一个窗口并赋给变量newwin。
        newwin.opener = null // 防止代码对论谈页面修改
        newwin.document.write(code);  //向这个打开的窗口中写入代码code,这样就实现了运行代码功能。
        newwin.document.close();
    }
}
function saveCode(obj) {
if(obj.innerText!="")
{
var code=obj.innerText;  
var newwin=window.open("","","");
newwin.opener = null
newwin.document.write(code);
newwin.document.execCommand("saveas","","maosin.js")
newwin.window.close();
}
else alert('没有代码可保存!')  
}   
function linkcode()
{
	if(document.linkform.yourname.value==""){
		alert("请输入您姓名!");
		document.linkform.yourname.focus();
		return false;
	}
	if(document.linkform.sitename.value==""){
		alert("请输入您的网站名称!");
		document.linkform.sitename.focus();
		return false;
		}
	if((document.linkform.weburl.value=="") || (document.linkform.weburl.value=="http://")){
		alert("请输入您的网站地址!");
		document.linkform.weburl.focus();
		return false;
	}
	if(document.linkform.info.value==""){
		alert("请输入您的网站简介!");
		document.linkform.info.focus();
		return false;
	}
	if(document.linkform.logourl.value==""){
		if(confirm("如logn地地址不填写,我们会默认为 文字链接 \n\n您是否要填写?")){
			document.linkform.logourl.focus();
			return false;}
		else{
			return true;}
		}
	return true;
}
function contentlen(obj)
{	
	var use=document.getElementById("useing");
	var yis=document.getElementById("yis");
	var maxlen=document.getElementById("maxlen").value;
	
	if(obj.value.length>maxlen){
		obj.value=obj.value.substring(0,maxlen);
		alert("已经超出"+maxlen+"字符!");
	}else{
		use.value=obj.value.length;
		yis.value=maxlen-use.value;
	}		//alert(obj.value.length);	}
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
function checkgb(obj)
{
	if(checkspace(obj.gb_username.value)){
		alert("请输入您的姓名!");
		obj.gb_username.focus();
		return false;
	}
	if(checkspace(obj.gb_title.value)){
		alert("请您输入留言主题");
		obj.gb_title.focus();
		return false;
	}
	if(checkspace(obj.content.value) || obj.content.value.length<6){
		alert("留言内容不能少于 8 个字符");
		obj.content.focus();
		return false;
	}
	obj.submit();
}
function setColor(color_val) {
	document.getElementById('bg').style.backgroundColor = color_val;
}
function sufm()
{
	if(window.document.pl.pl_name.value=="")
	{window.alert("请输入你的姓名!");
	window.document.pl.pl_name.focus();
	 return false;}
	if(window.document.pl.pl_content.value=="")
	{window.alert("请输入您发表的评论内容");
	 window.document.pl.pl_content.focus();
	 return false;}
	 document.pl.submit();
	 return true;
}
function copyurl()
{	
	clipboardData.setData("text",window.location.href);
	alert("地址复制成功,请粘贴到你的QQ或MSN上发送给你的好友"); 
}
function show(obj){
	var position=obj.parentElement.parentElement.parentElement.nextSibling;
	var img=new Image();
	img.src="images/-.gif";
	if(position.style.display=="none"){
		position.style.display="block";
		obj.src="images/-.gif"
		}
	else{
		position.style.display="none";
		obj.src="images/+.gif"
		}
}
function popwin(id,path)
{		window.open("player.asp?id="+id+"&rsid="+path,"","height=430,width=480,resizable=no,scrollbars=no,status=no,toolbar=no,menubar=no,location=no");
}
function showtvClass(obj){
	var position=obj.nextSibling;
	var dd=obj.previousSibling;
	var img=new Image();
	img.src="images/tv/firstnodeclose.gif";
	img.src="images/tv/folderclose.gif";
	var isfirst=obj.firstChild.getAttribute("id").toString();
	if(position.style.display=="none"){
		position.style.display="block";
		if(isfirst=="tvimg"){
		obj.firstChild.src="images/tv/firstnodeopen.gif";
		}else if(isfirst=="tvimg1"){
		obj.firstChild.src="images/tv/lastnodeopen.gif";
		}else{
		obj.firstChild.src="images/tv/nodeopen.gif";}
		obj.firstChild.nextSibling.src="images/tv/folderopen.gif";
	}else{
		position.style.display="none";
		if(isfirst=="tvimg"){
		obj.firstChild.src="images/tv/firstnodeclose.gif";
		}else if(isfirst=="tvimg1"){
		obj.firstChild.src="images/tv/lastnodeclose.gif";
		}else{
		obj.firstChild.src="images/tv/nodeclose.gif";}
		obj.firstChild.nextSibling.src="images/tv/folderclose.gif";
		}
}
//-->

⌨️ 快捷键说明

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