Get value in Iframe.

I have a page with 3 frames, frame 1 possesss a iframe and inside of the iframe it has one combobox, as I make for frame 3 to get the value of combo using Javascipt
gpsbrAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pravin AsarPrincipal Systems EngineerCommented:
To access the selectMonth (of type <select>) in the form "MyForm" from a document loaded in the iframe named 'ifr3'
styntax is

top.ifr3.window.document.MyForm.selectMonth.options.length;

Pravin AsarPrincipal Systems EngineerCommented:
To get the value,

top.ifr3.window.document.MyForm.selectMonth.value


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Pravin AsarPrincipal Systems EngineerCommented:
<html>
<head>
<title>Frame3 Access </title>
<script language="javascript">
function LoadMessage() {
        var selObj = top.ifr3.window.document.MyForm.selectMonth);
        alert ('Sel Obj : ' + selObj.options.length);
}
</script>
</head>

<body onLoad="LoadMessage();">
<iframe id="ifr1" width="100" height="100" title="iframe 1">
</iframe>
<iframe id="ifr2" height="100" width="100" title="Iframe 2">
</iframe>
<iframe id="ifr3" name="ifr3" height="100" width="100" title="iframe 3" src="form.htm">
</iframe>
</body>
</html>

<!--- form.htm -->
<html>
<head>
<title>Form in the frame ifr3 </title>
</head>
<body>
<form name="MyForm">
<select  name="selectMonth" >
  <option selected value="Jan">Jan</option>
  <option value="Feb">Feb</option>
  <option value="Mar" selected >Mar</option>
  <option value="Apr">Apr</option>
  <option value="May">May</option>
  <option value="Jun">Jun</option>
  <option value="Jul">Jul</option>
  <option value="Aug">Aug</option>
  <option value="Sep">Sep</option>
  <option value="Oct">Oct</option>
  <option value="Nov">Nov</option>
  <option value="Dec">Dec</option>
</select>
</form>
</body>
</html>

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.