DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> CSS入門知識 >> CSS詳解 >> 做程序經常有html與asp的代碼互換
做程序經常有html與asp的代碼互換
編輯:CSS詳解     

<!-- 把如下代碼加入<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>
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved