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

📄 top.js

📁 交流采样的滤波资料和一些参考程序
💻 JS
字号:
var xmlHttp;
var xmlHttpType;
function createXMLHttpRuest(){
    if(window.ActiveXObject){
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        xmlHttpType="POST";
    }
    else if(window.XMLHttpRequest){
        xmlHttp = new XMLHttpRequest();
        xmlHttpType="GET";
    }
}
function onReadyStateChange(){
	if(xmlHttp.readyState == 4){
	    if(xmlHttp.status==200){
            var text = xmlHttp.responseText;
            if(text==0){return false;}else{return true;}    
		}
	}
}
function onDataChange(){
	if(xmlHttp.readyState == 4){
	    if(xmlHttp.status==200){
            var text = xmlHttp.responseText;
            return text;   
		}
	}
}
function Init()
{
    setSearch();
    var Ylogin = document.getElementById("Ylogin");
    var Nlogin = document.getElementById("Nlogin");
    var url = "http://bbs.mcuol.com/transfer.aspx"
    createXMLHttpRuest();
    xmlHttp.onreadystatechange = onDataChange;
    xmlHttp.open(xmlHttpType,url,false);
    xmlHttp.send(null);
    var text = onDataChange();
    if(text==0){
        Nlogin.innerHTML="<a href=\"javascript:void(0)\" onClick=\"openWindow('http://bbs.mcuol.com/login.aspx','280','180','会员登录','登录');\">登录</a>  | <a href=\"http://reg.mcuol.com/Register.aspx\" target=\"_blank\">注册</a> | <a href=\"http:\/\/www.mcuol.com\/\">首页<\/a> | <a href=\"javascript:;\" onclick=\"window.external.addFavorite(\'http:\/\/www.mcuol.com\',\'嵌入式在线\');\" >收藏<\/a>";  
        Nlogin.style.display="block";
    }
    else{
        var uid = text.split(',')[0];
        var nickname = text.split(',')[1];
        var uname = text.split(',')[2];
        var type = text.split(',')[3];
        if(type==0){
            Ylogin.innerHTML="您好,<font color=red>"+nickname+"</font>&nbsp;<a href=\"javascript:void(0)\" onClick=\"openWindow('http://www.mcuol.com/Message/receivebox.aspx','500','349','短消息','true');\">短消息</a> [<a href=\"http://www.mcuol.com/aspx/logout.aspx?type=0\">退出</a>]&nbsp;<a href='http://blog.mcuol.com/"+uname+"' target=\"_blank\">我的博客</a>&nbsp;&nbsp;<a href=\"http://blog.mcuol.com/admin\" target=\"_blank\">管理后台</a>";
            Ylogin.style.display="block";
        }
        else{
            Ylogin.innerHTML="您好,<font color=red>"+nickname+"</font> [<a href=\"http://www.mcuol.com/aspx/logout.aspx?type=1\">退出</a>]&nbsp;&nbsp;<a href=\"http://company.mcuol.com/Manage\" target=\"_blank\">进入管理后台</a>";
        }
    }
}
function setSearch()
{
    var href= window.location.href;
    var channel = href.split('/')[3].toLowerCase();
    if(channel=="news"){
        document.getElementById("SelectType").selectedIndex = 1;
        return;
    }
    else if(channel=="domain"){
        document.getElementById("SelectType").selectedIndex = 1;
        return;
    }
    else if(channel=="tech"){
        document.getElementById("SelectType").selectedIndex = 8;
        return;
    }
    else if(channel=="solution"){
        document.getElementById("SelectType").selectedIndex = 4;
        return;
    }
    else if(channel=="download"){
        document.getElementById("SelectType").selectedIndex = 7;
        return;
    }
    else if(channel=="product"){
        document.getElementById("SelectType").selectedIndex = 3;
        return;
    }
    else if(channel=="edu"){
        document.getElementById("SelectType").selectedIndex = 1;
        return;
    }
    else if(channel=="meeting"){
        document.getElementById("SelectType").selectedIndex = 1;
        return;
    }
    else{
        var o = href.split('/')[2].toLowerCase();
        if(o=="company.mcuol.com"){
            document.getElementById("SelectType").selectedIndex = 2;
            return;
        }
        else if(o=="bbs.mcuol.com"){
            document.getElementById("SelectType").selectedIndex = 5;
            return;
        }
        else if(o=="blog.mcuol.com"){
            document.getElementById("SelectType").selectedIndex = 6;
            return;
        }
        else if(o=="bulo.mcuol.com"){
            document.getElementById("SelectType").selectedIndex = 6;
            return;
        }
        else{
            document.getElementById("SelectType").selectedIndex = 0;
            return;
        }
    }
}
function searchT()
{
    var SelectType=document.getElementById("SelectType")
    var type = SelectType.options[SelectType.selectedIndex].value;
    var content = escape(document.getElementById("search").value.trim());
    if(content=="")
    {
        window.alert('请输入要搜索的内容!');
	    return;
    }
    if(type==0){
        window.location="http://search.mcuol.com/search.aspx?type=0&q="+content;
    }
    else if(type==1){
        window.location="http://search.mcuol.com/search.aspx?type=1&q="+content;
    }
    else if(type==2){
        window.location="http://search.mcuol.com/search.aspx?type=2&q="+content;
    }
    else if(type==3){
        window.location="http://search.mcuol.com/search.aspx?type=3&q="+content;
    }
	else if(type==4){
	    window.location="http://search.mcuol.com/search.aspx?type=4&q="+content;
	}
    else if(type==5){
	    window.location="http://search.mcuol.com/search.aspx?type=5&q="+content;
	}
	else if(type==6){
	    window.location="http://search.mcuol.com/search.aspx?type=6&q="+content;
	}
    else if(type==7){
	    window.location="http://search.mcuol.com/search.aspx?type=7&q="+content;
	}
    else{
        window.location="http://search.mcuol.com/search.aspx?type=8&q="+content;
    }
}
function getimgcode(){
    var getimagecode = document.getElementById("getcode");
    getimagecode.src = "http://www.mcuol.com/include/VerifyCode.aspx?x="+Math.random();
}
function out_code(code){
    var url;
    var now = new Date(); 
    var num=now.getYear()+now.getMonth()+now.getDay()+now.getHours()+now.getMinutes()+now.getTime();
    url = "http://bbs.mcuol.com/ValidCode.aspx?v="+code+"&x="+num;
    createXMLHttpRuest();
    xmlHttp.onreadystatechange = onReadyStateChange;
    xmlHttp.open(xmlHttpType,url,false);
    xmlHttp.send(null);
    if(!onReadyStateChange()){return false;}else{return true;}
}
function checkComment()
{
    var content = document.getElementById("content").value.trim();
    var code = document.getElementById("code").value.trim();
    var contentlen = sl(content);
    if(content==''){
        alert("评论内容不能为空");  
        document.getElementById("content").focus();
        return;
    }
    else if(contentlen>1000){
        alert("最多只能输入500个汉字");  
        document.getElementById("content").focus();
        return;
    }
    else if(code=='' || code.length<4){
        alert("验证码输入错误!");
        document.getElementById("code").focus();
        return;
    }
    else if(!out_code(code)){
        alert("验证码输入错误!");  
        document.getElementById("code").focus();
        return;
    }
    document.PForm.submit();
}
String.prototype.trim = function()
{
    // 用正则表达式将前后空格,用空字符串替代。
    return this.replace(/(^\s*)|(\s*$)/g, "");
}
//检查中文字符长度
function sl(st){
	sl1=st.length;
	strLen=0;
	for(i=0;i<sl1;i++){
		if(st.charCodeAt(i)>255) strLen+=2;
	 else strLen++;
	}
	return strLen;
}

⌨️ 快捷键说明

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