回4楼: innerHeight, innerWidthRead-only properties that specify the height and width, in pixels, of the document display area of this window. These dimensions do not include the size of the menu bar, toolbars, scrollbars, and so on. These properties are not supported by IE. Instead use the clientWidth and clientHeight properties of document.documentElement or document.body (depending on the version of IE). 这是javascript 权威指南里面的,这两个值貌似返回的是浏览区域的高和宽。
<input type="button" onclick="alert(document.getElementsByName('radio')[2].checked)" value="test1" />
<input type="radio" name="radio" id="radio" value="radio" />
<input type="radio" name="radio" id="radio" value="radio" />
<input type="radio" name="radio" id="radio" value="radio" />
<hr />
<input type="button" onclick="alert(document.images[0].width+'*'+document.images[0].height)" value="test2" />
<img src="http://i3.sinaimg.cn/home/deco/2008/0325/sinahome_Logo.gif" />
<hr />
<input type="button" onclick="frames[0].document.body.innerHTML=document.getElementById('div1').innerHTML;" value="test3" />
<div id="div1">Text<img src="http://i3.sinaimg.cn/home/deco/2008/0325/sinahome_Logo.gif" /><button onclick="alert('嗯')">按钮</button></div>
<iframe width="320px" height="240"></iframe>
clientWidth 获取对象的宽度,不计算任何边距、边框、滚动条,但包括该对象的补白。此外,还有一些其它类型的获取方法,可以查查手册。
第一个问题是从一组已经check了的单选组,现在要找出那个被选中的对象的value;
第二个问题是在没有给对象定义height和width的情况下,这样如果按你的方法是取undefined;
第三个问题恕我没有表达清楚,我是主要是要截取一个div中元素转换为图片,iframe只是我曾经看到的一种方法,好象可以把里面的元素变成一个图片。
innerHeight, innerWidthRead-only properties that specify the height and width, in pixels, of the document display area of this window. These dimensions do not include the size of the menu bar, toolbars, scrollbars, and so on. These properties are not supported by IE. Instead use the clientWidth and clientHeight properties of document.documentElement or document.body (depending on the version of IE). 这是javascript 权威指南里面的,这两个值貌似返回的是浏览区域的高和宽。