Front-Html/Jquery
jquery iframe load 처리
seongsland
2011. 12. 5. 17:42
frame은 ready() 로 처리해도 안되고.. load () 로 해야된다.
아래 예제..
frame 안의 접근은 $(this.contentDocument). 로 해야 된다는것..
아래 예제..
frame 안의 접근은 $(this.contentDocument). 로 해야 된다는것..
< html > < head > < title >jQuery and Frames</ title > < script type = "text/javascript" src = "jquery.js" ></ script > < script type = "text/javascript" > jQuery( function() { $('#frame1').load( function(){ $(this.contentDocument).find('body').html('This frame was modified with jQuery! Yay!!!') }); $('#frame2').load( function(){ $(this.contentDocument).find('body').html('This frame was modified with jQuery! Yay!!!') }); }); </ script > </ head > < body > < h2 >jQuery and Frames</ h2 > < h4 >Frame from the < i >same</ i > domain as parent.</ h4 > < iframe id = "frame1" src = "iframe.html" ></ iframe > < h4 >Frame from a < i >different</ i > domain as parent.</ h4 > </ body > </ html > |