Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

run function

Posted on 2004-04-15
5
Medium Priority
?
203 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

An overview of cyber security, cyber crime, and personal protection against hackers. Includes a brief summary of the Equifax breach and why everyone should be aware of it. Other subjects include: how cyber security has failed to advance with technol…
Tech spooks aren't just for those who are tech savvy, it also happens to those of us running a business. Check out the top tech spooks for business owners.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

610 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