"WH" <ke***@whitehouse.gov> writes:
No, notwrking. Test this
<body onload="document.getElementById('myframe').focus() ;" leftMargin="0"
rightMargin="0" topMargin="0" marginwidth="0" marginheight="0">
<iframe id="myframe" src="http://www.yahoo.com" width=100% height=100%
FRAMEBORDER="0"></iframe>
Two points:
The "focus" function exists on window objects, not (i)frame objects.
Using "getElementById" will give you the iframe object, not the window
object inside it. Sadly, there is no standard way to access that window
(some browsers has the non-standard "frameElement.contentWindow",
others only have "frameElement.contentDocument"). To access frames
by name, the best way is to use the frames collection (available as
a global variable, i.e, a property of the window object):
frames['myframe'].focus;
Also, your iframe contains content from another domain. The security
settings might, or might not, prevent you from interacting with the
embedded page's window. Whether it works might depend on whether the
embedded page has begun loading or not, when you access it.
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'