ASP常见问题及解答(3)
1.图片显示控制:<script language="JavaScript">
<!--
var flag=false;
function DrawImage(ImgD){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= 360/270){
if(image.width>360){
ImgD.width=360;
ImgD.height=(image.height*360)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
else{
if(image.height>270){
ImgD.height=270;
ImgD.width=(image.width*270)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
}
}
//-->
</script>
调用格式:
<img src="a.gif" onload="javascript:DrawImage(this);"
2.用asp把doc转换成html
doc2html.vbs
'**********************************************************
'
' 调用方法:doc2html c:doc2html c:doc2html
' 调用方法:doc2html -s c:doc2htmla.doc c:doc2html
'
'**********************************************************
Dim Objword
Dim Objdoc
Dim Objfso
Dim Strsource
Dim Strtarget
Dim Bbatch
'得到命令行参数,有三种可能的格式:[-s] 要进行转换的源文件目录或文件 转换成Html文件后保存的目录
Function Getparams()
Dim Objarg
If Wscript.Arguments.Count >= 2 Then
If Wscript.Arguments.Item(0) = "-s" Or Wscript.Arguments.Item(0) = "-S" Then
Strsource = Wscript.Arguments.Item(1)
Strtarget = Wscript.Arguments.Item(2)
Bbatch = False
Else
Strsource = Wscript.Arguments.Item(0)
补充:asp教程,技巧与性能优化