给你个例子希望对你有帮助:
<HTML> 
<HEAD> 
<TITLE>键盘和鼠标事件测试</TITLE> 
<script language="javascript"> 
function keyDown(e) {
  s = event.srcElement.tagName+"<br/>";
  for(v in event)
    s += v+"="+event[v]+"<br/>";
  view.innerHTML = s;
sss.innerHTML = event.screenX+","+event.screenY;
return false;

document.onkeydown=keyDown 
document.onkeyup=keyDown 
document.onmousedown=keyDown 
document.onmouseup=keyDown 
document.onmousemove=keyDown 
document.onmouseover=keyDown 
document.onmouseout=keyDown 
document.onkeypress=keyDown 
</script> 
</HEAD> <BODY> 
<p>请操作鼠标或键盘</p> <input type=text><span id="sss"></span>
<table border>
<tr><td>123</td><td>abc</td></tr>
</table>
<span id="view"></span>
</BODY> 
</HTML> 

解决方案 »

  1.   

    offsetWidth:
    Returns the width of the element relative to the document's top-left corner
    WIDTH: 
    Along with HEIGHT, sets the initial size of the iframe. This attribute may be initially set in pixels or percentages. 
    获得frame的大小:
    child.htm中
    parent.document.all.iframename.width
    parent.document.all.iframename.height
      

  2.   

    参考:
    http://expert.csdn.net/Expert/topic/1395/1395554.xml?temp=.2373773