Forum Moderators: coopster
I humbly request Mods to put a sticky here for posting guidelines.
anyway, to guide you, you can use javascript to read iframe body data into a variable and then you can parse it using any of the following.
var body = iframename.document.body.innerText;
var body = iframename.document.body.innerHTML;
now you have all the body text in a variable and you can do whatever you want to. you can use either pure javascript for parsing or send this variable to a php page from javascript, AJAX, for parsing.
I hope that helps.
IFRAMES INTERACTING
I have spent several months improving my webPage and, yesterday, after deep progress (and many brain nodes since July), I've finally found the so expected solution to our common problem.
I'll try to set it out to you, even if you've probably adopted an alternative option ever since then :
self.document points the mainPage out.
self.window points the documents set of the mainPage out AND the mainPage itself.
It might be the leading difference between the two reserved words document & window. window represents a document when it is not indexed but, it also represents an Array of documents when it is.
Let's consider a mainPage (which can be a frame or an iFrame itself) holding several iFrames ; self.window.length will return the number of contained iFrames as a value.
If we want to focus on iFrame #1 from the mainPage, we must call to self.window[0] but, to catch its document up we must call to self.window[0].document.
Considering all that, to have access to particular elements of iFrame #1 from the mainPage, follow this examples table indications :
IFRAME #i ELEMENT -------------------- WAY TO CALL TO FROM THE MAINPAGE
title ----------------------------------- self.window[i-1].document.title
body HTML source --------------------- self.window[i-1].document.body.innerHTML
value of an element
the identifier of wich is object1 ---------- self.window[i-1].document.getElementById("object1").value
PAY ATTENTION!
To launch the execution of a not argumented function of iFrame #1 named iFrame#1_FCT() from the mainPage, man has to call to self.window[0].iFrame#1_FCT(); as well as document.mainPage_FCT() is not a valid formulation.
To go deeply from all that, launching an argumented function of iFrame #1 (with arguments also contained in iFrame #1) from the mainPage, the correct formulation is based on this schema :
self.window[0].iFrame#1_argumentedFCT( self.window[0].document.getElementById("iFrame#1_argument").value );
where iFrame#1_argument can be the identifier of a valued div.
This solution to our problem is valid for IE as well as for NS5+ (I can't test it with NS4).
I've tried to explain it more efficiently in this few pages.
So if I name my iframe "content" I would want to use this?
var content = self.window[content-1].document.body.innerHTML How would I make that into a function so I can call it onclick, also, how do I do a print to screen so I can verifiy if it's fetching the right source?