日期:2014-05-17  浏览次数:20914 次

跟帖,紧接综合问题。
问题1:
HTML code

if (!xmlhttp3 && typeof XMLHttpRequest != "undefined")
{
xmlhttp3 = new XMLHttpRequest();
}


这里有语法错误吗?或有其它错误吗?
、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
问题2:
HTML code

<%
dim a1,a2
a1="<script language=""javascript"" type=""text/javascript"">var b1=new Array(11,12,13,15,21);document.write(b1);</script>"
a2=split(a1,",")
for i=0 to ubound(a2)
response.write(a2(i))
next
%>


这里怎么显示undefind呢?

------解决方案--------------------
考虑到兼容性:
JScript code
function getxmlxhhp(){
            var xmlHttp=null;
            try{
                xmlHttp=new XMLHttpRequest();
            }
            catch (e){
                try{
                    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch (e1){
                    try{
                        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                    }catch(e2){
                        xmlHttp=null;
                    }
                }
            }
            return xmlHttp;
        }

------解决方案--------------------
关于这个问题:

<%
dim a1,a2
a1="<script language=""javascript"" type=""text/javascript"">var b1=new Array(11,12,13,15,21);document.write(b1);</script>"
a2=split(a1,",")
for i=0 to ubound(a2)
response.write(a2(i))
next
%>


我看来看去也很奇怪,没太明白你为什么不直接把这段 JavaScript 写进HTML就算了,而是非要先给Basic,再用其输出到HTML上。更没搞懂为啥你还要将其按照“逗号”进行字符串切分。。。

最后也没搞懂为啥你在JS中,想直接在document中输出这个数组对象,而不是数组元素呢?

为啥不直接写:
<script language="javascript">
var b1=[11, 12, 13, 15, 21]; // JS中数组可以直接这样写。
for (i=0; i<b1.length; i++) alert(b1[i]); // 这个会弹出很多对话框稍微有点烦。
</script>
------解决方案--------------------
JScript code
     var xmlobject=false;//创建一个XMLHttpRequest对象
    if(window.XMLHttpRequest)
    {
        xmlobject=new XMLHttpRequest();
    }
    else if(window.ActiveXObject)
    {
        xmlobject=new ActiveXObject("Microsoft.XMLHTTP");
    }

------解决方案--------------------
探讨
HTML code


function yyy3()
{
try {xmlhttp3 = new ActiveXObject("Msxml2.XMLHTTP");}catch(e)
{
try {xmlhttp3 = new ActiveXObject("Microsoft.XMLHTTP");}catch(e2){xmlhttp3 = false;}
}
if (!xmlht……