⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hack9.js

📁 Ajax.Hacks,快来看啊
💻 JS
字号:
var request;var symbol;   //will hold the stock symbolfunction getStockPrice(sym){    symbol=sym;    if(sym)  {    var url="http://www.parkerriver.com/s/stocks?symbol="+sym;    httpRequest("GET",url,true);   }}//event handler for XMLHttpRequestfunction handleResponse(){    if(request.readyState == 4){        if(request.status == 200){            /*Grab the result as a string*/            var stockPrice = request.responseText;            var info = "«The  price is: $"+stockPrice+"»";                document.getElementById("stPrice").style.fontSize="0.9em";                document.getElementById("stPrice").style.backgroundColor="yellow";                document.getElementById("stPrice").innerHTML =info;                    } else {            alert("A problem occurred with communicating between the XMLHttpRequest object and the server program.");        }    }//end outer if}/* Initialize a Request object that is already constructed */function initReq(reqType,url,bool){    /* Specify the function that will handle the HTTP response */    request.onreadystatechange=handleResponse;    request.open(reqType,url,bool);    request.send(null);}/* Wrapper function for constructing a Request object. Parameters:  reqType: The HTTP request type such as GET or POST.  url: The URL of the server program.  asynch: Whether to send the request asynchronously or not. */function httpRequest(reqType,url,asynch){    //Mozilla-based browsers    if(window.XMLHttpRequest){        request = new XMLHttpRequest();    } else if (window.ActiveXObject){        request=new ActiveXObject("Msxml2.XMLHTTP");        if (! request){            request=new ActiveXObject("Microsoft.XMLHTTP");        }     }    //the request could still be null if neither ActiveXObject    //initializations succeeded    if(request){       initReq(reqType,url,asynch);    }  else {        alert("Your browser does not permit the use of all "+        "of this application's features!");}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -