1 <!DOCTYPE HTML>2 <HTML>3 <HeadLang= "en">4 <MetaCharSet= "UTF-8">5 <title></title>6 </Head>7 <Scripttype= "Text/javascript"src=".. /.. /js/system.js "></Script>8 <Body>9ID Number:<DivID= "Showid"></Div>Ten <inputtype= "button"value= "Get"ID= "BTN"> One <Scripttype= "Text/javascript"> A $$("btn"). onclick= function () { - varURL= "http://ama.adwo.com/advmessage/adv/addResultJsonP.action?advid=30125"; - varXHR= NULL;//set to NULL for compatibility processing the //Compatibility processing - if(window. XMLHttpRequest) {//General Browser Use - XHR= NewXMLHttpRequest (); - } Else if(window. ActiveXObject) {//IE6 Use below + XHR= NewActiveXObject ("Microsoft.XMLHTTP"); - } + //Open this object first A Xhr.open ("GET", URLs,true);//How to send the data get, path URL, at //then send the request again - xhr.send (); - Xhr.onreadystatechange= function () { - if(Xhr.readystate== 4) {//the request is complete and the response is ready - //200 corresponds to OK, such as 404-page not found - if(Xhr.status== $) {//"OK" in //get the contents of the URL address - varneed=Xhr.response; to //truncate the string in the middle brace, including the curly braces + varSt=Need.split ("[")[1]; - varSTT=St.split ("]")[0]; the //converts the acquired string to an object and is named C * Eval ("var c=" +STT); $ $$("Showid"). InnerHTML=c.id;Panax Notoginseng comm.cl (xhr.response); - } the } + } A }; the </Script> + </Body> - </HTML>
Gets the ID on the address (the page interacts with the server)