- <HTML>
- <HEAD>
- <TITLE> New Document </TITLE>
- <meta http-equiv=Content-Type conent="text/html";charset="gb2312">
- <script type="text/javascript">
- var xmlHttp;
- function createObject(){
- xmlHttp=null;
- try{
- xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
- }catch(e){
- xmlHttp=new XMLHttpRequest();
- }
- return xmlHttp; //create Object
- }
- function getResult(name){ //submit & get result
- xmlHttp=createObject();
- xmlHttp.onreadystatechange=function(){
- if(xmlHttp.readyState==4){ //receive the responseText
- var result=xmlHttp.responseText;
- alert(result); //display result
- }
- };
- var serverPage=document.getElementById("keyWord").value; //set url
- xmlHttp.open("get",serverPage,true); //send request
- xmlHttp.send(null);
- }
- </script>
- </HEAD>
- <BODY>
- <input type="text" value="" id="keyWord" size="150"><p></p>
- <input type="button" value="Search" οnclick="getResult(this.value);"><P>
- <span id="set" rows="50" cols="100">
- </span>
- </BODY>
- </HTML>
获取某个网页的源码
最新推荐文章于 2022-04-06 10:18:00 发布