网页设计师联盟

--- 学习、交流、展示、资源

招聘精英个人求职网站发布网友作品网页特效动画欣赏网页素材免费资源源码下载设计软件
作品欣赏       域名申请       虚拟主机
网页设计师

  • 新闻资讯
  • 网页教程
  • 平面教程
  • 程序设计
  • 视频教程
  • Flash教程

网页设计师站提供网页设计程序设计服务 E-mail:liangfeng0526@qq.com

 您当前的位置:首页 > 阅读文章
网页设计师联盟(www.wysjs.cn)欢迎您!
 标题:

做程序经常有html与asp的代码互换

<!-- 把如下代码加入<body>区域中 -->
 <SCRIPT language=vbscript>
<!--
function autocr()
if checkbox.checked then
html.wrap="soft"
asp.wrap="soft"
else
html.wrap="off"
asp.wrap ="off"
end if
end function

function HtmlToAsp(str)
dim i,AspStr,tmp,st
AspStr=""
for i=1 to Len (str)
tmp=Mid(str,i,1)
select case tmp
case """"
if not st then tmp=""""""
case "<"
if Mid(str,i+1,1)="%" then
tmp="""&"
if mid(str,i+2,1)="=" then i=i+2 else i=i+1
st=true
end if
case "%"
if Mid(str,i+1,1)=">" then
tmp="&"""
st=false
i=i+1
end if
end select
AspStr=AspStr&tmp
next
HtmlToAsp="Response.Write """&AspStr&"""&VbCrLf"
end function

function AspToHtml(str)
dim i,HtmStr,tmp,itmp,st
str=Trim(str)
HtmStr=""
st=3
if strcomp(mid(str,1,14),"Response.Write",1)=0 then str=LTrim(mid(str,15))
for i=1 to Len(str)
tmp=Mid (str,i,1)
if tmp="""" then
if mid(str,i+1,1)="""" and st=1 then
tmp=""""
i=i+1
elseif mid(str,i+1,1)="&" and st=1 then
st=0
if mid(str,i+2,1)="""" then
tmp=""
st=1
i=i+2
elseif strcomp(mid(str,i+2,6),"VbCrLf",1)=0 then
if i+7=len(str) then tmp="" else tmp=VbCrLf
i=i+7
else
tmp="<%"
i=i+1
end if
elseif st=3 then
tmp=""
st=1
elseif i=len(str) and st=1 then
tmp=""
st=0
end if
elseif tmp="&" and mid(str,i+1,1)="""" and st=0 then
st=1
tmp="%>"
i=i+1
end if
HtmStr=HtmStr&tmp
next
AspToHtml=HtmStr
end function

 

function hta()
dim ahtm,aspstr,inum
if html.value>"" then
ahtm=Split (html.value ,vbCrLf,-1,0)
inum=UBound(ahtm)
for i=0 to inum
aspstr=aspstr&HtmlToAsp (ahtm(i))
if i<inum-1 then aspstr=aspstr&vbCrLf
next
asp.value =aspstr
end if
end function

function ath()
dim aasp,htmstr,inum
if asp.value>"" then
aasp=Split (asp.value ,vbCrLf,-1,0)
inum=UBound (aasp)
for i=0 to inum
htmstr=htmstr&AspToHtml (aasp(i))
if i<inum-1 then htmstr =htmstr &vbCrLf
next
html.value =htmstr
end if
end function

function selall(obj)
obj.select
end function
-->
</SCRIPT>
<TABLE id=AutoNumber1 style="BORDER-COLLAPSE: collapse" borderColor=#111111
cellSpacing=0 cellPadding=5 width="100%" border=0>
  <TBODY>
  <TR>
    <TD width="100%" colSpan=3><TEXTAREA class=myinput onfocus=selall(html) name=html rows=10 wrap=off cols=102></TEXTAREA>
    </TD></TR>
  <TR>
    <TD width="40%">
      <P align=right><INPUT class=mybutton style="WIDTH: 150px; HEIGHT: 25px" onclick=hta type=button value=HTML转ASP name=toasp>
      </P></TD>
    <TD width="16%">  <INPUT onclick=autocr type=checkbox value=checkbox
      name=checkbox> 自动换行</TD>
    <TD width="44%"><INPUT class=mybutton style="WIDTH: 150px; HEIGHT: 25px" onclick=ath type=button value=ASP转HTML name=tohtml>
    </TD></TR>
  <TR>
    <TD width="100%" colSpan=3><TEXTAREA class=myinput onfocus=selall(asp) name=asp rows=10 wrap=off cols=102></TEXTAREA>
    </TD></TR>
  <TR align=middle>
    <TD width="100%" colSpan=3>  </TD></TR></TBODY></TABLE>

  • (刊登方式:转载   来源:网络   作者:   添加:admin   关键词:)
  • 您已阅读:做程序经常有html与asp的代码互换 您还可以继续阅读↓  或 回到首页看看>>>
  • 上一篇按钮控制窗口移动 (功能比较丰富)

    <!--把下列代码加到<body>区域中--> <INPUTTYPE="TEXT"size="18"value="这是默认的内容"onfocus="if(value=='这是默认的内容'){value=''}"onblur="if(value==''){value='这是默认的内容'}">

  • 下一篇特酷的高级计算器,功能非常强大

    <!--第一步:把如下代码加入<body>区域中--><SCRIPTLANGUAGE="javascript"><!--Beginfunctiondoit(){form.input.value=eval(form.input.value)}functionCos(){x=form.input.valueif(x=='')alert('Error:InputRequired');elseform.input.value=Math.cos..