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

· 2015-10-15 (목) 22:13:48 · 1264 · 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-11-03 조회 574
15-11-02 조회 543
15-11-02 조회 537
15-11-02 조회 467
15-10-31 조회 460
15-10-27 조회 674
15-10-23 조회 587
15-10-23 조회 603
15-10-19 조회 1,495
15-10-15 조회 1,265
15-08-03 조회 1,188
15-07-29 조회 995
15-07-12 조회 1,157
15-05-07 조회 2,532
15-05-06 조회 2,081
15-05-06 조회 2,841
15-04-04 조회 2,013
15-04-04 조회 1,533
15-04-01 조회 3,331
15-02-10 조회 1,984
15-01-31 조회 1,907
15-01-23 조회 1,703
14-12-30 조회 1,282
14-12-23 조회 1,466
14-12-02 조회 1,793