Solved

run function

Posted on 2004-04-15
5
197 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
This article outlines the process to identify and resolve account lockout in an Active Directory environment.
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.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

773 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