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

· 2015-10-15 (목) 22:13:48 · 1259 · 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 조회 693
15-10-15 조회 1,260
15-10-09 조회 1,440
15-10-06 조회 1,187
15-10-05 조회 655
15-10-05 조회 628
15-10-05 조회 621
15-10-04 조회 595
15-10-04 조회 683
15-10-04 조회 813
15-10-03 조회 1,091
15-10-03 조회 575
15-10-02 조회 965
15-10-02 조회 785
15-10-02 조회 640
15-10-01 조회 610
15-10-01 조회 674
15-10-01 조회 611
15-10-01 조회 641
15-10-01 조회 979
15-09-30 조회 547
15-09-30 조회 658
15-09-30 조회 821
15-09-30 조회 734
15-09-24 조회 727