천

자바스크립트로 Ajax 효과내기 입니다.

· 2016-01-21 (목) 00:23:32 · 434

일반 페이지에서 하단에 iframe을 만듭니다.
링크의 target을 iframe 이름으로 지정합니다.
링크의 href에 쓰인 파일은 Javascript로 parent의 element 값들을 수정합니다.

예를 들어서 다음 세 파일을 만들고 p.html을 부릅니다.
c.html============================
<html><body></body></html>
================================

p.html============================
<html><body>
hidden frame에서 form을 만들고
거기서 post한 후
script로  child frame에 데이터 수정하기
<a href=set.php target=aja >set</a>
<p style="border: 1px solid blue;height:20px;" id=content></p>
<iframe name=aja src=c.html height=10 width=300>
</body>
</html>
=================================
set.php============================
<html>
<head>
<script language=JavaScript>

parent.document.all.content.innerText="여기가 바뀌는 부분입니다.";
</script>
</html>  

댓글을 작성하시려면 로그인이 필요합니다.

팁게시판

6,077건

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

+
제목 글쓴이 날짜 조회
16-01-23 조회 401
16-01-22 조회 419
16-01-21 조회 564
16-01-21 조회 497
16-01-21 조회 435
16-01-20 조회 454
16-01-20 조회 415
16-01-20 조회 403
16-01-19 조회 479
16-01-19 조회 434
16-01-18 조회 491
16-01-16 조회 471
16-01-16 조회 379
16-01-16 조회 403
16-01-15 조회 564
16-01-15 조회 419
16-01-15 조회 416
16-01-15 조회 434
16-01-14 조회 473
16-01-14 조회 514
16-01-14 조회 577
16-01-13 조회 494
16-01-13 조회 532
16-01-13 조회 430
16-01-12 조회 406