// 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');"); } //半黑背景显示一幅图和文字========================================================================== //紧跟[body]后(或[/body]前)面必须有如下代码(在inc-bgb.asp中): //[div id="bgb" style="background-color:#000000; position:absolute; left:0px; top:0px; width:1600px; height:1200px; display:inline; z-index:1000; filter:alpha(opacity=75);"][/div] //[div id="bgb_cont" align="center" style="position:absolute; left:0px; top:200px; width:1003px; display:inline; z-index:1001;"] //[/div] function showbgb(pic,txt){ 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=document.body.scrollTop+(document.body.clientHeight-document.all.bgb_cont.clientHeight)/2; 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";} reLocateBgb(); } function reLocateBgb(){ 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.width=document.body.clientWidth; document.all.bgb_cont.style.top=document.body.scrollTop+(document.body.clientHeight-document.all.bgb_cont.clientHeight)/2; setTimeout("reLocateBgb()", 10); } // 日期选择器 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');"); } function setcolor(idname) { var sInitColor; if(sInitColor == null) var sColor = dlgHelper.ChooseColorDlg(); else var sColor = dlgHelper.ChooseColorDlg(sInitColor); sColor = sColor.toString(16); if (sColor.length < 6) { var sTempString = "000000".substring(0,6-sColor.length); sColor = sTempString.concat(sColor); } //eval("document.all." + idname + ".style.backgroundColor = '#" + sColor + "';"); eval("document.all." + idname + ".style.color = '#" + sColor + "';"); eval("document.all." + idname + ".value = '" + sColor + "';"); sInitColor = sColor; }