테스트 사이트 - 개발 중인 베타 버전입니다

iframe 안에 있는 CSS를 변경하고싶습니다. 채택완료

원자력장판 9년 전 조회 23,902

</p><p><script> </p><p><span style="font-size: 14.6667px; line-height: 22px;">$(document).ready(function(){</span> </p><p style="margin-left: 40px;"><span style="font-size: 14.6667px;">$('.iframe_row_div iframe').hover(function(){</span></p><p style="margin-left: 0px;"><span style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space:pre">		</span>$(this).parent().children('iframe').not(this).hide();</span></p><p style="margin-left: 0px;"><span style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space:pre">		</span>$(this).css('width', '100%');</span></p><p style="margin-left: 0px;"><span style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space:pre">		</span>$(this).contents().find('.sct_another_wrap2').attr('background', '#f4f4f4');</span></p><p style="margin-left: 0px;"> </p><p style="margin-left: 0px;"><span style="font-size: 14.6667px;"><span class="Apple-tab-span" style="white-space:pre">	</span>});</span></p><p><span style="font-size: 14.6667px; line-height: 22px;">});</span></p><p><span style="font-size: 14.6667px;"></script></span> </p><p><span style="font-size: 14.6667px; line-height: 22px;"><div class="iframe_row_div"></span> </p><p style="margin-left: 40px;"><span style="font-size: 14.6667px; line-height: 22px;"><iframe src="웹페이지 주소"  border="0" frameborder="0" scrolling="no" class="iframe01"></iframe></span></p><p style="margin-left: 0px;"><span style="font-size: 14.6667px; line-height: 22px;"></div></span></p><p>

 

이런식으로 소스를 짰습니다.

 

원래 아이프레임의 width값이 236px인데.. hover를 하면 width값이 100%가 되면서 아이프레임 안에있는 .sct_another_wrap2 라는 div의 배경색을 바꾸게 할려고 하고있습니다.

 

width값 부분은 매우 잘되는데, 안의 css를 수정할려고 하니 문제가 됩니다.

 

jquery-1.8.3.min.js:2 Uncaught SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "현재 페이지 주소" from accessing a frame with origin "아이프레임 주소". Protocols, domains, and ports must match. 

 

라는 오류가 뜨는데.. 원인과 해결 방법을 모르겠습니다;;

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

답변 1개

채택된 답변
+20 포인트
y
9년 전
아이프레임 주소와 현재 페이지가 다른 도메인이라면 접근불가입니다.
로그인 후 평가할 수 있습니다

답변에 대한 댓글 3개

원자력장판
9년 전
아 그렇군요. 답변 감사합니다.

그러면 값 전달도 되지 않는건가요? 값 전달로라도 해볼까 하는데..
달콤별
9년 전
아이프레임 페이지 수정이 가능하다면 제어 방법이 있는것 같네요.
http://joont.tistory.com/18
원자력장판
9년 전
답변 감사합니다. 한번 해보겠습니다. :)

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

답변을 작성하려면 로그인이 필요합니다.

로그인