Javascript 框架内容的大小

Javascript 框架内容的大小,javascript,Javascript,我有一个宽度,比如说,200像素的框架。框架内的内容大于200像素。如何找到内容的大小 我可以使用 <iframe id="frame_name" src="bla bla"></iframe> t = document.getElementById ("frame_name"); t.contentWindow.scrollTo(x,y); t=document.getElementById(“帧名称”); t、 contentWindow.scrollTo(x,y

我有一个宽度,比如说,200像素的框架。框架内的内容大于200像素。如何找到内容的大小

我可以使用

<iframe id="frame_name" src="bla bla"></iframe>
t = document.getElementById ("frame_name");
t.contentWindow.scrollTo(x,y);

t=document.getElementById(“帧名称”);
t、 contentWindow.scrollTo(x,y);

但我不知道什么时候停止,因为我不知道内容的宽度。请不要使用jquery,谢谢。

在Chrome和Safari中,您可以使用
t.contentWindow.document.width
t.contentWindow.document.height


在Firefox、IE和Safari中,您可以使用
t.contentDocument.body.scrollWidth
t.contentDocument.body.scrollHeight

是同一个域上的
iframe
src吗?是的,所有内容都在同一个域中aint.contentWindow.document.width未定义…(我正在Firefox 21.0中测试它)更新的答案包括Firefox谢谢Borre!如果不是要求太高,IE和Safari的属性名称是什么?再次感谢=)Firefox解决方案在IE中工作,我无法测试Safari,因为我没有Mac,但我假设Chrome解决方案在Safari中也能工作,contentWindow.document.width和contentDocument.body.scrollWidth似乎都能工作。