troubleshooting Question

processing mhtml in javascript

Avatar of chadnash1
chadnash1 asked on
Web BrowsersJavaScript
3 Comments1 Solution1289 ViewsLast Modified:
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

ASKER CERTIFIED SOLUTION
Lolly-Ink

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros