|
默认不设置word break之类就会按照英文单词来换行 而不会拆分单词,只有在测试时或者是人家捣乱时才会出现NNN长单词撑页面问题,下面是解决这个例外事件的方法:
============================================================ function name: autowrap
description : 解决长英文不自动换行的问题
parameters : a_strSourceString :要转换的源字符串
a_intSize , 每行宽度
author: bigeagle
date : 2000/4/17
history: 2000/4/17 : version 1.0
-------------------------------------------------------------------------------- '本函数来源于凯旋网络-http://www.creatsoon.com function AutoWrap(a_strSourceString , a_intSize) dim l_strDestString '假如内容中有回车则退出 if instr(a_strSourceString , chr(13) + chr(10) ) <> 0 then AutoWrap = replace(a_strSourceString , chr(13) + chr(10) , "<br>") exit function end if check if valid parameters call assert(vartype(a_strSourceString) = 8 , "AutoWrap" , "a_strSourceString must be a string") call assert(vartype(a_intSize) = 2 , "AutoWrap" , "a_intSize must be a integer") dim i if a_intSize >= len(a_strSourceString) then l_strDestString = a_strSourceString else ’ l_strDestString = left(a_strSourceString , a_intSize) for i = 1 to len(a_strSourceString) step a_intSize if instr( i , mid(a_strSourceString , i , a_intSize) , chr(32) ) = 0 _ or instr( i , mid(a_strSourceString , i , a_intSize) , chr(13)+chr(10) )then l_strDestString = l_strDestString + " " + mid (a_strSourceString , i + 1 , a_intSize) else l_strDestString = l_strDestString + mid(a_strSourceString , i + 1 , a_intSize) end if next end if call print("[AutoWrap:]return value is : ’" + l_strDestString + "’") l_strDestString = replace(l_strDestString , chr(13) + chr(10) , "<br>") AutoWrap = l_strDestString end function
【2010-10-20】 【浏览74次】
上一篇:防止FLASH幻灯片特效出现虚线框
下一篇:外贸网站建设用什么英文字体合适?
|