js代码如下
<font color="#008000">查看Script值:</font><input id="javas" size="20" value><input type="button" value="查看" onmouseover="eval('javaas.value='+javas.value);">
<input id="javaas" size="30" >
<input type="button" value="更改" onclick="eval(javas.value+'=javaas.value')"><br>
<input id="a" size="20"><input type="button" value="显示对象" onclick="objs(a.value)">doc<br><textarea id="doc" rows="12" cols="89"></textarea>
<script>
br='\r'
function objs(obj){
docvalue=""
var disp;x=0;doc.value="变量为:"+obj+br;obj1=eval(obj);
for(var va in obj1){x++;disp=obj+"."+va+'='+obj1[va];docvalue+=x+': '+disp+br;}
doc.value+=docvalue+'End of obj';
}
</script>
在以JS为脚本的HTML页运行正常.
为了检查ASP把它改写为VBS代码
<font color="#008000">查看Script值:</font>
<input type=text id="javas" size="20">
<input type="button" value="查看" onMouseOver="Execute "javaas.value="&javas.value">
<input type="button" value="执行" onMouseOver="Execute javas.value">
<input id="javaas" size="30">
<input type="button" value="更改" onClick="Execute(javas.value&"=javaas.value")">
<br>
<input id="a" size="20">
<input type="button" value="显示对象" onClick="objs(a.value)">
doc<br>
<textarea id="doc" rows="12" cols="89"></textarea>
<script language="vbscript">
br=chr(13)
function objs(obj)
docvalue=""
dim disp,x,va
x=0
doc.value="变量为:"+obj+br
set obj1=eval(obj)
for Each va in obj1
x=x+1
disp=obj & "." & va & "=" & obj1[va]
docvalue=docvalue &cstr(x) &": " &disp &br
next
doc.value=doc.value+docvalue+"End of obj"
end function
</script>
能显示要求的值,但无法列出[object]对象,好像是VBS的FOR EACH语句不支持列出[object]对象.
请问要如何改才能在VBS列出每一个对象的内容例如document