你现在所在的位置->首页->javascript->图片自动缩放以适合界面大小
图片自动缩放以适合界面大小
时间:[2008-2-27 8:36:18] 作者:请作者尽快与我们联系。
如何让图片自动缩放以适合界面大小,拿出你的Editplus,打开c_function.asp文件,找到UBBCode函数,在第417行有如下语句
If Instr(strType,"[image]")>0 And ZC_UBB_IMAGE_ENABLE Then
'[img]
objRegExp.Pattern="(\[IMG=)([0-9]*),([0-9]*),(.*)(\])(.+?)(\[\/IMG\])"
strContent= objRegExp.Replace(strContent,"<img src=""$6"" alt=""$4"" title=""$4"" width=""$2"" height=""$3""/>")
objRegExp.Pattern="(\[IMG=)([0-9]*),(.*)(\])(.+?)(\[\/IMG\])"
strContent= objRegExp.Replace(strContent,"<img src=""$5"" alt=""$3"" title=""$3"" width=""$2""/>")
objRegExp.Pattern="(\[IMG\])(.+?)(\[\/IMG\])"
strContent= objRegExp.Replace(strContent,"<img src=""$2"" alt="""" title=""""/>")
End If
在其中加上onload='javascript:if(this.width>400)this.width=400;',这里400是要让超过400的图片小于400,你可以自己设定宽度.
下面是已经改好的
If Instr(strType,"[image]")>0 And ZC_UBB_IMAGE_ENABLE Then
'[img]
objRegExp.Pattern="(\[IMG=)([0-9]*),([0-9]*),(.*)(\])(.+?)(\[\/IMG\])"
strContent= objRegExp.Replace(strContent,"<img onload='javascript:if(this.width>400)this.width=400;' src=""$6"" alt=""$4"" title=""$4"" width=""$2"" height=""$3""/>")
objRegExp.Pattern="(\[IMG=)([0-9]*),(.*)(\])(.+?)(\[\/IMG\])"
strContent= objRegExp.Replace(strContent,"<img onload='javascript:if(this.width>400)this.width=400;' src=""$5"" alt=""$3"" title=""$3"" width=""$2""/>")
objRegExp.Pattern="(\[IMG\])(.+?)(\[\/IMG\])"
strContent= objRegExp.Replace(strContent,"<img onload='javascript:if(this.width>400)this.width=400;' src=""$2"" alt="""" title=""""/>")
End If 做人要厚道,请注明转自酷网动力(www.ASPCOOL.COM)。
If Instr(strType,"[image]")>0 And ZC_UBB_IMAGE_ENABLE Then
'[img]
objRegExp.Pattern="(\[IMG=)([0-9]*),([0-9]*),(.*)(\])(.+?)(\[\/IMG\])"
strContent= objRegExp.Replace(strContent,"<img src=""$6"" alt=""$4"" title=""$4"" width=""$2"" height=""$3""/>")
objRegExp.Pattern="(\[IMG=)([0-9]*),(.*)(\])(.+?)(\[\/IMG\])"
strContent= objRegExp.Replace(strContent,"<img src=""$5"" alt=""$3"" title=""$3"" width=""$2""/>")
objRegExp.Pattern="(\[IMG\])(.+?)(\[\/IMG\])"
strContent= objRegExp.Replace(strContent,"<img src=""$2"" alt="""" title=""""/>")
End If
在其中加上onload='javascript:if(this.width>400)this.width=400;',这里400是要让超过400的图片小于400,你可以自己设定宽度.
下面是已经改好的
If Instr(strType,"[image]")>0 And ZC_UBB_IMAGE_ENABLE Then
'[img]
objRegExp.Pattern="(\[IMG=)([0-9]*),([0-9]*),(.*)(\])(.+?)(\[\/IMG\])"
strContent= objRegExp.Replace(strContent,"<img onload='javascript:if(this.width>400)this.width=400;' src=""$6"" alt=""$4"" title=""$4"" width=""$2"" height=""$3""/>")
objRegExp.Pattern="(\[IMG=)([0-9]*),(.*)(\])(.+?)(\[\/IMG\])"
strContent= objRegExp.Replace(strContent,"<img onload='javascript:if(this.width>400)this.width=400;' src=""$5"" alt=""$3"" title=""$3"" width=""$2""/>")
objRegExp.Pattern="(\[IMG\])(.+?)(\[\/IMG\])"
strContent= objRegExp.Replace(strContent,"<img onload='javascript:if(this.width>400)this.width=400;' src=""$2"" alt="""" title=""""/>")
End If 做人要厚道,请注明转自酷网动力(www.ASPCOOL.COM)。
【声明】本站刊载的《图片自动缩放以适合界面大小》一文如果有侵害你权益的情况,请联系我们。我们将及时采取措施。
QQ:44637339 Email:just6@163.com Tel:13355163107 Lining studios