// JavaScript Document // 缩略图---限制图片的宽度和高度 function resizeImage(ImgD,w,h){ var image=new Image(); image.src=ImgD.src; if(image.width>0 && image.height>0){ flag=true; if(image.width/image.height>= w/h){ if(image.width>w){ ImgD.width=w; ImgD.height=(image.height*w)/image.width; }else{ ImgD.width=image.width; ImgD.height=image.height; } }else{ if(image.height>h){ ImgD.height=h; ImgD.width=(image.width*h)/image.height; }else{ ImgD.width=image.width; ImgD.height=image.height; } } } } function DrawImage(ImgD){ var flag=false; var w; w=110; var h; h=110; var image=new Image(); image.src=ImgD.src; if(image.width>0 && image.height>0){ flag=true; if(image.width/image.height>= w/h){ if(image.width>w){ ImgD.width=w; ImgD.height=(image.height*w)/image.width; }else{ ImgD.width=image.width; ImgD.height=image.height; } }else{ if(image.height>h){ ImgD.height=h; ImgD.width=(image.width*h)/image.height; }else{ ImgD.width=image.width; ImgD.height=image.height; } } } } // 显示第n个对象,其他对象隐藏(obj为对象系列名称,total为同系列对象的总数,n为指定显示对象的序号) function showhideObjs(obj,total,n){ for(i=0;i<=total;i++){ if(i==n){eval("document.all." + obj + i +".style.display=(document.all." + obj + i +".style.display=='none'?'inline':'none');");} else{eval("document.all." + obj + i +".style.display='none';");} } } function showhideObj(obj){ eval("document.all." + obj +".style.display=(document.all." + obj +".style.display=='none'?'inline':'none');"); } //半黑背景显示一幅图和文字 //紧跟后(或前)面必须有如下代码(在inc-bgb.asp中): //
//
//
function showbgb(pic,txt,cttop){ document.all.logo.style.display="none"; document.all.bgb.style.display="inline"; document.all.bgb.style.width=document.body.scrollWidth; document.all.bgb.style.height=document.body.clientHeight>document.body.scrollHeight ? document.body.clientHeight : document.body.scrollHeight; document.all.bgb_cont.style.display="inline"; document.all.bgb_cont.style.width=document.body.clientWidth; document.all.bgb_cont.style.top=cttop+document.body.scrollTop; document.all.bgb_txt.innerHTML=txt; if(pic!=""){document.all.bgb_pic.style.display="inline";document.all.bgb_img.src=pic;} else{document.all.bgb_pic.style.display="none";} } // 日期选择器 function show_calendar(id) { var x,y,URL,para; x = event.clientX + 20; y = event.clientY + 120; URL='calendar.asp?form=form1&field=' + id; para='directorys=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,left='+x+',top='+y+',width=190,height=140' window.open(URL,'',para); } // 隐藏/打开左栏 function switchLRBar(){ if (switchLR.innerText==3){ switchLR.innerText=4 document.all("frmLeft").style.display="none" } else{ switchLR.innerText=3 document.all("frmLeft").style.display="" } } // 隐藏/打开上栏 function switchUDBar(){ if (switchUD.innerText==5){ switchUD.innerText=6 document.all("frmTiTle").style.display="none" } else{ switchUD.innerText=5 document.all("frmTitle").style.display="" } } //替换对象中的内容 function replaceOBJ(obj,str1,str2){ var str=obj.innerHTML; str=str.replace(str1,str2); obj.innerHTML=str; if(str.indexOf(str1)>-1){replaceOBJ(obj,str1,str2)}; } function showhideObj(obj){ eval("document.all." + obj +".style.display=(document.all." + obj +".style.display=='none'?'inline':'none');"); }