[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Get value in Iframe.

Posted on 2006-03-23
3
Medium Priority
?
1,592 Views
Last Modified: 2008-01-09
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
0
Comment
Question by:gpsbr
  • 3
3 Comments
 
LVL 29

Expert Comment

by:Pravin Asar
ID: 16273699
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;

0
 
LVL 29

Accepted Solution

by:
Pravin Asar earned 750 total points
ID: 16273703
To get the value,

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


0
 
LVL 29

Expert Comment

by:Pravin Asar
ID: 16273741
<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>

0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question