GetFormEleName=""
formename="input,select,textarea"
farr=split(formename,",")
tmparr = split(Txt,chr(13)&chr(10))
if ubound(tmparr)<=0 then Exit Function
Start=false
sEnd=false
tmpstr=""
'********************************************
for i=0 to ubound(tmparr) '循环整个文章
j=0
for j=lbound(farr) to ubound(farr) '循环判断是否有表单元素
tmparr(i)=replace(replace(replace(replace(replace(tmparr(i),"%"," "),"/"," "),"<"," "),">"," "),"'"," ")
StartTxtLine=0
StartTxtLine=instr(lcase(trim(tmparr(i))),lcase(farr(j))) '表单元素出现在的位置
if StartTxtLine>0 then '如果有表单元素
tmpstr1=mid(trim(tmparr(i)),StartTxtLine+len(farr(j)),StartTxtLine+len(farr(j))+1) '取表单元素后一个字符是什么
if asc(tmpstr1)=32 then '判断是否是空格,是空格才往下执行,以防类似于select 与selected 区别错误,此句有时会错误,尚未查出原因
sPoint=instr(lcase(tmparr(i)),"name") '表单元素名称出现的位置
ePoint=instr(right(tmparr(i),len(tmparr(i))-(sPoint+len("name"))),chr(32))'表单元素名称结束的位置
tmpstr=trim(replace(replace(replace(mid(tmparr(i),sPoint+len("name"),ePoint),"""",""),">",""),"=",""))'取出表单元素名称
if tmpstr<>"" then
tmparray=split(GetFormEleName,",")
ishave=false '初始化,用来判断在是否已经存在这个名称
for k=lbound(tmparray) to ubound(tmparray) '循环取出已取出的表单元素来判断,是否已经存在
if lcase(tmparray(k))=lcase(tmpstr) then
ishave=true
exit for
end if
next
if not ishave then GetFormEleName=GetFormEleName&","&tmpstr '不存在才加上来
end if
end if
end if
next
next
if len(GetFormEleName)>0 then
GetFormEleName=right(GetFormEleName,len(GetFormEleName)-1)'去掉右边的逗号
end if
End Function
'--------------获取网页-----------------------------------
function getHTTPPage(url)
on error resume next
dim http
set http=Server.createobject("Msxml2.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then exit function
getHTTPPage=bytes2BSTR(Http.responseBody)
set http=nothing
if err.number<>0 then err.Clear
end function
Function bytes2BSTR(vIn)
dim strReturn
dim i,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
<script language="JavaScript">
function Copy()
{
var obj_1=document.all.t1.getElementsByTagName('INPUT')
var obj_2=document.all.t2.getElementsByTagName('INPUT')
for (var i=0;i<obj_1.length;i++)
{
if (obj_1(i).type=="text"&&obj_2(i))
obj_2(i).value=obj_1(i).value;
}
}
</script>
<input type="button" value="click" onClick="Copy()">