faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

27 of 41 people (66%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

how to get data from iframe using java script

Apr 8th, 2008 18:39
ha mo, Dave Clark, MACHARLA KUMAR,


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Macharla,
     First of all, the document in the IFRAME and the parent document 
must both be in the same domain.  If they aren't, then there is no 
solution for you due to Internet security issues.  Otherwise, make 
sure to give the IFRAME tag a "name" attribute setting.  Then, from 
the parent document, the following will retrieve the value of a form 
field where the form is in a document within an IFRAME within the 
parent document:
var f = self.frames['iframeName'].document.forms['formName'];
alert('Field value is "' + f.elements['fieldName'].value + '".');
Take care,
Dave Clark
www.DaveClarkConsulting.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com