wonnylee Posted April 16, 2009 Share Posted April 16, 2009 I looked up the help file, and found there is _IEFrameGetObjByName function. but Iframe that i want to using has no name, but an ID. How can i get an object from IE IFrame using ID? instead of Name, since there's no name. sourecode get with DebugBar is like this. <iframe id=my-134 src="http://blahblahblah.jsp"></firame> Link to comment Share on other sites More sharing options...
Authenticity Posted April 16, 2009 Share Posted April 16, 2009 _IEGetObjById()? Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 16, 2009 Share Posted April 16, 2009 _IEGetObjById()? Actually, the id and name tags are not distinguished in the IE DOM. The only difference between them is that many elements can have the same name, but only one is allowed the same id. The function _IEFrameGetObjByName() works with either the name or id attribute. Demo: expandcollapse popup#include <IE.au3> $oIE = _My_Example() Sleep(3000) $oFrame = _IEFrameGetObjByName($oIE, "iFrameOne") _IEBodyWriteHTML($oFrame, "Hello iFrame <b>One!</b>") _IELoadWait($oFrame) Sleep(3000) $oFrame = _IEFrameGetObjByName($oIE, "iFrameTwo") _IEBodyWriteHTML($oFrame, "Hello iFrame <b>Two!</b>") _IELoadWait($oFrame) ; Derived directly from Dale Hohm's _IE_Example("iFrame") Func _My_Example() Local $s_html = "", $o_object $s_html &= "<HTML>" & @CR $s_html &= "<HEAD>" & @CR $s_html &= "<TITLE>_IE_Example('iframe')</TITLE>" & @CR $s_html &= "</HEAD>" & @CR $s_html &= "<BODY>" & @CR $s_html &= "<table cellspacing=6 cellpadding=6 border=1>" & @CR $s_html &= "<tr>" & @CR $s_html &= "<td><iframe name='iFrameOne' src='about:blank' title='iFrameOne'></iframe></td>" & @CR $s_html &= "<td><iframe name="iFrameOne" src="about:blank" title="iFrameOne"></td>" & @CR $s_html &= "</tr>" & @CR $s_html &= "<tr>" & @CR $s_html &= "<td><iframe id='iFrameTwo' src='about:blank' title='iFrameTwo'></iframe></td>" & @CR $s_html &= "<td><iframe id="iFrameTwo" src="about:blank" title="iFrameTwo"></td>" & @CR $s_html &= "</tr>" & @CR $s_html &= "</table>" & @CR $s_html &= "</BODY>" & @CR $s_html &= "</HTML>" $o_object = _IECreate() _IEDocWriteHTML($o_object, $s_html) _IEAction($o_object, "refresh") Local $oIFrameOne = _IEFrameGetObjByName($o_object, "iFrameOne") Local $oIFrameTwo = _IEFrameGetObjByName($o_object, "iFrameTwo") _IEBodyWriteHTML($oIFrameOne, '$oIFrameOne = _IEFrameGetObjByName($oIE, "iFrameOne")') _IEBodyWriteHTML($oIFrameTwo, '$oIFrameTwo = _IEFrameGetObjByName($oIE, "iFrameTwo")') Return $o_object EndFunc ;==>_IE_Example Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
nicky40 Posted April 17, 2009 Share Posted April 17, 2009 This helped me too, thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now