开发者

object required error

where is error?

<iframe  src="jquerytabs/index.html" name="bulten"  scrolling="auto"  id="ifr2" frameborder="0开发者_如何学运维" style="width:100%;" marginheight="0" marginwidth="7"  height="288" ></iframe>


<script type="text/javascript"> 
document.write(parent.document.getElementById('ifr2').src) --->error is here but how can I correct?
</script>   


The error means that parent.document.getElementById('ifr2') is returning null. Why are you using parent.document instead of just document?

Does your script really come after the <iframe>, as it does in the code you posted? Is it possible that you have more than one element with the same "id" value ("ifr2") (probably not, but it's worth checking)?


Are you trying to read the iframe URL or the HTML of the content inside the iframe? Your posted code seems to indicate the former, if the parent. part is removed:

<script type="text/javascript"> 
  document.write(document.getElementById('ifr2').src);
</script>


I have more than one element with the same "id" value ("ifr2") but I changed "id" valume.Now no problem :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜