Avatar of chadnash1
chadnash1

asked on 

processing mhtml in javascript

using ie 6

I have an IFrame with the src being a mhtml file
I want to have java script to access the objects of the mhtml file but cant
I can getto the IFrame and to the ontentWindow of the IFrame but cant get inside the contentwindow at all

attached is the things I tried

Thanks Chad

<html>
<body>
 
aa
<iframe name="iframename" id="iframeid" src="Hi.mht">
 
</iframe>
<script>
function stuff()
{
 
 
	var iframe = document.getElementById("iframeid");
	alert(iframe.name);
 
	var iframeW = iframe.contentWindow
	alert(iframeW);
	var frames=iframeW.frames;
	alert("FRAMES=" +frames);
	alert("frames.length=" +frames.length);
 
	//alert("iframeW.external="+iframeW.external);
	alert("iframeW.behaviorUrns="+iframeW.behaviorUrns);
 
	alert("iframeW.all="+iframeW.all);
	//alert("iframeW.all.length="+iframeW.all.length);
	alert("iframeW.length="+iframeW.length);
	alert("iframeW.contents="+iframeW.contents);
	var temp = "";
	var obj = iframeW;
	for (x in obj)
	        //{temp += x + ": " + obj[x] + "\n";}
	        {temp += x + "\n";}
	alert (temp);
	alert("iframeW.window="+iframeW.window);
	temp = "";
	obj = iframeW.window;
		for (x in obj)
		        //{temp += x + ": " + obj[x] + "\n";}
		        {temp += x + "\n";}
	alert (temp);
	alert("iframeW.window.document="+iframeW.window.document);
	alert("iframeW.document="+iframeW.document);
 
	var iframedoc = iframeW.document;
 
	alert(" hi1 ");
	alert(iframedoc);
	alert(" hi2 ");
	alert(iframe);
	alert("iframe.childNodes" + iframe.childNodes);
	alert(iframe.childNodes.length);
	var i;
	for(i = 0 ; i<=iframe.childNodes.length;i++)
	{
	 alert(iframe.childNodes(i));
	 alert("<br />");
	}
	alert(" hi3 ");
 
	alert(iframedoc.body);
	alert(iframedoc.anchors.length);
 
	for(i = 0 ; i<=iframedoc.anchors.length;i++)
	{
	 alert(iframedoc.anchors(i));
	 alert("<br />");
	}
 
}
 
stuff();
//var t= setTimeout("stuff();",1000);
</script>
 
</body>
</html>

Open in new window

Web BrowsersJavaScript

Avatar of undefined
Last Comment
Lolly-Ink

8/22/2022 - Mon