천

로컬에서 자바스크립트 HTML 소스 가져오기

<html> 

<head> 

<title>::: 노글스 :::</title> 

</head> 

<body> 

<input type=button onClick=chk() value="chk"> 

결과 

 

<script> 

var sHttp = new ActiveXObject("Microsoft.xmlhttp"); 

 

function httpGet(szURL) { 

  sHttp.open("get",szURL,false); 

  sHttp.setRequestHeader( "Content-type:", "application/x-www-form-urlencoded"); 

sHttp.setRequestHeader("Content-Encoding:", "euc-kr"); 

 

 

  sHttp.onreadystatechange = onRetriveComplete; 

  try{ 

  sHttp.send("code=tnt2"); 

  } 

  catch(e) { 

      return ("Not exist"); 

  } 

 

  if (sHttp.status > 200) { 

  return("not exist<br>"); 

  } else 

 

 

  return(sHttp.responseText); 

 

} 

 

function onRetriveComplete() { 

  sHttp.onreadystatechange = noop; //re-entrant gate 

  if (sHttp.readyState == 4) { 

  } 

} 

 

function noop() { 

  return false; 

} 

 

function chk() { 

 

  getData=httpGet("http://www.phpschool.com/bbs2/inc_board.html"); 

 

  document.noglsForm.test.value=getData; 

 

} 

</script> 

 

<form name=noglsForm> 

<textarea name=test rows=200 cols=200></textarea> 

</form> 

</body> 

</html> 


|

댓글 1개

혀니천사 님, 암것도 안 올라 오네요. ^^;
댓글을 작성하시려면 로그인이 필요합니다.

개발자팁

5,403건

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
PHP 15-11-05 조회 4,148
PHP 15-11-05 조회 3,048
PHP 15-11-04 조회 2,574
PHP 15-11-04 조회 2,725
PHP 15-11-04 조회 3,130
JavaScript 15-11-04 조회 5,337
PHP 15-11-04 조회 4,103
PHP 15-11-04 조회 3,207
PHP 15-11-03 조회 3,453
MySQL 15-11-03 조회 4,643
MySQL 15-11-02 조회 2,496
PHP 15-11-02 조회 2,943
PHP 15-11-02 조회 2,774
PHP 15-11-02 조회 2,952
PHP 15-10-31 조회 2,837
MySQL 15-10-30 조회 4,263
MySQL 15-10-30 조회 2,965
MySQL 15-10-29 조회 3,198
PHP 15-10-27 조회 2,624
PHP 15-10-23 조회 3,054
PHP 15-10-23 조회 4,050
웹서버 15-10-21 조회 3,126
PHP 15-10-19 조회 7,452
OS 15-10-17 조회 4,083
OS 15-10-17 조회 3,247
웹서버 15-10-17 조회 4,248
PHP 15-10-15 조회 7,704
jQuery 15-10-06 조회 4,412
기타 15-10-05 조회 2,905
기타 15-10-05 조회 3,200