js读取文本到textarea中,为什么同样的代码放到服务器上为何就不行 <script language=vbscript> Function bytes2BSTR(vIn) 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> <script language="JavaScript"> function f(){ var xmlUrl = new ActiveXObject('Microsoft.XMLHTTP'); var r; var filepath= document.getElementById("fileField").value //alert(filepath); xmlUrl.Open('GET',filepath); xmlUrl.Send(); r=bytes2BSTR(xmlUrl.ResponseBody); document.getElementById("Content").value = r; } </script>