再次申明:微软最新的研究决定也只是把xmlhttp操作客户端文件的权限去掉了.所以尽可放心使用. 大家试试这个页面,后台随便用什么response.writer都可以. <HTML> <HEAD> <SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript> <!-- function button1_onclick() { //When the button is clicked call the open document Function OpenXMLDoc() } //--> </SCRIPT> </HEAD> <BODY> <INPUT type="button" value="Fill Box" id=button1 name=button1 LANGUAGE=javascript onclick="return button1_onclick()"><BR><BR> <SCRIPT Language = "VbScript"> Function OpenXMLDoc 'Create XMLHTTP Object to Prepare to send XML across HTTP. Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
'Prepare the XMLHTTP Request object to issue a synchronous HTTP POST 'request to the URL to send the XML Tree. xmlhttp.open "POST","http://mattison/ReturnXML/ReturnXMLdata.aspx", false
'Send the HTTP request xmlhttp.send
'Use XML Data returned. FillListBox(xmlhttp.ResponseText) Set xmlhttp = Nothing Set xmldoc = Nothing End Function Function FillListBox(strXML) 'Create a client side XML doc Set xmlCustomersDoc = CreateObject("Microsoft.XMLDOM") 'Load the xml into the document xmlCustomersDoc.loadXML strXML 'Get the Customer Nodes Set CustomerNameNodes = xmlCustomersDoc.getElementsByTagName("Customer") Dim Elem 'Loop through them and add an entry to the list box each time. For each Elem in CustomerNameNodes Set selElement = document.createElement("OPTION") selElement.Text = Elem.text select1.options.add selElement Next 'Close the document Set xmlCustomersDoc = Nothing End Function </SCRIPT> <br> <SELECT id=select1 name=select1> </SELECT> </BODY> </HTML> </BODY> </HTML>
第一.xmlhttp是后台提交(及模拟post操作,页面并不提交),这一点大家可以证明;
第二.xmlhttp为ie内部控件不会有任何安全提示.所以并不是真正的使用控件,只是使用ie的
一种功能而已.这一点大家也可以证明.
大家试试这个页面,后台随便用什么response.writer都可以.
<HTML>
<HEAD>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function button1_onclick() {
//When the button is clicked call the open document Function
OpenXMLDoc()
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<INPUT type="button" value="Fill Box" id=button1 name=button1
LANGUAGE=javascript onclick="return button1_onclick()"><BR><BR>
<SCRIPT Language = "VbScript">
Function OpenXMLDoc
'Create XMLHTTP Object to Prepare to send XML across HTTP.
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
'Prepare the XMLHTTP Request object to issue a synchronous HTTP POST
'request to the URL to send the XML Tree.
xmlhttp.open "POST","http://mattison/ReturnXML/ReturnXMLdata.aspx",
false
'Send the HTTP request
xmlhttp.send
'Use XML Data returned.
FillListBox(xmlhttp.ResponseText)
Set xmlhttp = Nothing
Set xmldoc = Nothing
End Function
Function FillListBox(strXML)
'Create a client side XML doc
Set xmlCustomersDoc = CreateObject("Microsoft.XMLDOM")
'Load the xml into the document
xmlCustomersDoc.loadXML strXML
'Get the Customer Nodes
Set CustomerNameNodes = xmlCustomersDoc.getElementsByTagName("Customer")
Dim Elem
'Loop through them and add an entry to the list box each time.
For each Elem in CustomerNameNodes
Set selElement = document.createElement("OPTION")
selElement.Text = Elem.text
select1.options.add selElement
Next
'Close the document
Set xmlCustomersDoc = Nothing
End Function
</SCRIPT>
<br>
<SELECT id=select1 name=select1>
</SELECT>
</BODY>
</HTML>
</BODY>
</HTML>
俺的文档里说得很清楚,有源码
大部分的浏览器用的都是ie的核心,而且支持com插件,所以只要用的是windows客户端就没有
问题,和浏览器没关系.毕竟xmlhttp不仅是ie的组件也是windows的组件啊.
你写的东西要是windows都不支持,这样的烂东西我宁可不看!大言不惭.你这种舍大家而取小家的做法真是要反省一下.根本不理解其中的技术,简单的一个javascript还讨论半天,大家撤吧.
我的意思是非要在windows客户端看,那这失去了跨平台性。当然做出来的东西windows系统上肯定可以看,linux和unix上的浏览器也可以看才对, IE5, Mozilla , Opera,netscape都应该支持。我们做的是产品,需要在linux上运行。