做网站不只是铺门面,适合自己品牌理念的网站建设才能促进营销!
广州网站制作、广州网站建设、广州做网站,首选广州凯旋网络公司!
当前位置:首页 >> 新闻资讯 >> 网页编程知识 >> 完美解决英文换行、英文断词

完美解决英文换行、英文断词

Tags: 英文换行    英文断词   

默认不设置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幻灯片特效出现虚线框
下一篇:外贸网站建设用什么英文字体合适?
本类最新
网站制作时关于管理员账号删除的设计[11.18]
购物网站常用功能之Session显示最近浏览的代码[11.15]
只能输入数字的JS验证函数[11.15]
ASP实现网页参数的判断[11.15]
最简洁的ASP多条件查询语法[11.14]
 
本类热门
document.getElementById详解[09.02]
制作网页的5条非常不错的建议[09.16]
动态更换CSS的JS代码[08.19]
目前非常全面的CSS兼容问题资料汇集[08.31]
网页设计:DIV+CSS:如何编写代码才能更有效率[11.22]
广州做网站的公司性质客户可免预付款,广州凯旋网络工作室做广州最好的网站制作公司,做广州最有实力的网站建设公司。
广州网络公司-凯旋网络工作室唯一官方网址:Www.CreatSoon.Com
本站设计版权归凯旋网络所有,未经允许不得复制或设立镜像。

凯旋网络2011年最新精品网站制作案例:地下金属探测仪器 地下金属探测器 地下金属探测仪 掘金1号地下金属探测器 
粤ICP备05124435号 网站地图  免责声明