欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

asp上传带显示的代码

程序员文章站 2022-10-27 18:49:55
注意是用到了,下列的演示 adti...
注意是用到了,下列的演示
<script language="javascript" type="text/javascript">
adtime=8;
chancead=1;
var ns=(document.layers);
var ie=(document.all);
var w3=(document.getelementbyid && !ie);
adcount=0;
function initad(){
        if(!ns && !ie && !w3) return;
        if(ie)                addiv=eval('document.all.sponsoraddiv.style');
        else if(ns)        addiv=eval('document.layers["sponsoraddiv"]');
        else if(w3)        addiv=eval('document.getelementbyid("sponsoraddiv").style');
        randad=math.ceil(math.random()*chancead);
        if (ie||w3)
        addiv.visibility="visible";
        else
        addiv.visibility ="show";
        if(randad==1) showad();
}
function showad(){
if(adcount<adtime*10){adcount+=1;
        if (ie){documentwidth  =document.body.offsetwidth/2+document.body.scrollleft-20;
        documentheight =document.body.offsetheight/2+document.body.scrolltop-20;}
        else if (ns){documentwidth=window.innerwidth/2+window.pagexoffset-20;
        documentheight=window.innerheight/2+window.pageyoffset-20;}
        else if (w3){documentwidth=self.innerwidth/2+window.pagexoffset-20;
        documentheight=self.innerheight/2+window.pageyoffset-20;}
        addiv.left=documentwidth-100;addiv.top =documentheight-0;
        settimeout("showad()",100);}
}
function closead(){
if (ie||w3)
addiv.display="none";
else
addiv.visibility ="hide";
}
function $(obj){
    return document.getelementbyid(obj);
}

function checkform(){
    if($("file1").value != "")
    {
                if(/jpg|jpeg|gif|bmp/i.test($("file1").value.match(/\.(\w+)$/)[0]) == false){
                    alert("您只能上传图片文件");
                    return false;
                }
                else
                {
                    return true;
                }
    }
    else
    {
        alert("您还没有选中需要上传的图片");
        return false;
    }
}