천

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

· 2015-10-15 (목) 22:13:48 · 1276 · 1

<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개

2015-10-21 (수) 16:46:56
혀니천사 님, 암것도 안 올라 오네요. ^^;
댓글을 작성하시려면 로그인이 필요합니다.

팁게시판

6,077건

디자인과 관련된 유용한 정보를 공유하세요. 질문은 상단의 QA에서 해주시기 바랍니다.

+
제목 글쓴이 날짜 조회
15-10-17 조회 766
15-10-17 조회 598
15-04-03 조회 1,663
14-07-09 조회 2,765
14-01-03 조회 2,249
13-09-29 조회 1,695
13-07-01 조회 1,425
13-04-27 조회 3,946
13-04-07 조회 1,601
13-01-30 조회 3,721
13-01-15 조회 4,135
12-12-15 조회 3,939
12-12-15 조회 3,382
12-12-12 조회 2,375
12-12-12 조회 5,315
12-12-10 조회 3,476
12-12-10 조회 1,933
12-12-03 조회 1,666
12-12-02 조회 1,394
12-11-26 조회 1,373
12-11-26 조회 1,548