2
<script>
$("#frameDemo").contents().find("a").css("background-color", "#BADA55");
</script>
보낸 사람 JQ docs.일반적인 방법으로 동일한 도메인의 iframe에 액세스 할 수없는 이유는 무엇입니까?
로컬 호스트에서 문제가 될 수 있습니까?
<script>
$(document).ready(function(){
$('#sample_test').contents().find('a').css('color', 'red')
})
</script>
<iframe src="http://localhost:3000/tests/384" width="100%" seamless="seamless" height="1150px" scrolling="no" id="sample_test"></iframe>
나를 위해 작동하지 않습니다.
이 부모 창 – putvande
@putvande의 도메인 무엇입니까, 모두 메인 페이지 및 iframe을 사용하여 색상을 변경하려고 아직 때 그것은 또한 당신의 iframe을 준비 아니라고 수 있습니다 로컬 호스트 –
에 있습니다. 그것을 setTimeout에서 감싸고 무슨 일이 일어나는지 보거나 iframe에 'onload'를 추가하십시오. – putvande