Tired of flashing pages? Try JavaScript + WebService!

xiaoxiao2021-03-06  40

I believe that everyone has encountered such a situation, instant sending short messages in the system of B / S, the general method is the timing refresh page, but if you are tired of non-flashing pages, you may wish to come. Try the solution to JavaScript WebService. // deptCode is the department number to detect if there is an unread information Function Monimsg (deptcode) {var deptcode = document.getElementByid ("deptcode"). Value; var mywebservice = "http://122124.6.70/khmis/websvr / Kkh_msg.asmx "; var mymethod =" http://tempuri.org/hasnewmsg ";

Var RequestHttp = New ActiveXObject ("Microsoft.xmlhttp"); var s = ""; s = s " / n" s = s " / N "s = s " / N "; // ------------ Write input parameters ------------------------- ---------------------- S = S / n "; s = S "" deptcode " / n"; s = s " / n"; // ---------------- -------------------------------------------------- ----- S = S / n "s = s " "// This is a focus! requestHttp.Open ( "POST", myWebService, false); requestHttp.SetRequestheader ( "Content-Type", "text / xml; Charset = gb2312"); requestHttp.SetRequestheader ( "SOAPAction", myMethod); requestHttp.Send (s ); Res = requesthttp.responsexml; var pos1 = res. xml.indexof (""); var pos2 = res. xml.indexof (""); var len = POS2 - POS1 - (" "). Length; var result = res. xml.substr (POS1 (" "). Length, len); if (Document.getElementByid (" ishashistorymsg "). Value =="

转载请注明原文地址:https://www.9cbs.com/read-53659.html

New Post(0)