Solved

run function

Posted on 2004-04-15
5
196 Views
Last Modified: 2012-05-04
Hi Experts,

I have JSP page within IFRAME and need to execute Javascript located in main page when some key is pressed. How ?

Thank you.
0
Comment
Question by:fpoyavo
  • 3
  • 2
5 Comments
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 10835112
With my limited knowledge of javascript.. its seems that its not possible...

is it a inline function or its a function thats written in a .js file and js file is included??
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 10835278
The problem is that this is function using elements of the main page. May be You know how to access elements of the main page from IFRAME ?

Thank you.
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 10835330
oh yeah thats easy...:-)

parent.document.getElementByid("elementName");

or
ParentFrameName.document.getElemenetById(""elementName");
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 10835394
almost correct.. should be top.document.getElementById('elementName').value.
0
 
LVL 19

Accepted Solution

by:
Kuldeepchaturvedi earned 500 total points
ID: 10835421
top.document.getElementById('elementName').value.
works only if you have one level of framing... if you have a frame and then a frame inside the frame then top might not give the right results.. that why I tried doing it with names... the correct one wd have been...

top.framename.document.getElementById('elementName').value.
btw in java script whatever runs is correct to me....:-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Stuck in Bootstrap WysiHtml Editor 3 37
String format issue 13 90
how to exclude a file using regex 5 117
Use tracing facilities in your browser steps 2 110
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
In 2017, ransomware will become so virulent and widespread that if you aren’t a victim yourself, you will know someone who is.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

895 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now