• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 208
  • Last Modified:

run function

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
fpoyavo
Asked:
fpoyavo
  • 3
  • 2
1 Solution
 
KuldeepchaturvediCommented:
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
 
fpoyavoAuthor Commented:
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
 
KuldeepchaturvediCommented:
oh yeah thats easy...:-)

parent.document.getElementByid("elementName");

or
ParentFrameName.document.getElemenetById(""elementName");
0
 
fpoyavoAuthor Commented:
almost correct.. should be top.document.getElementById('elementName').value.
0
 
KuldeepchaturvediCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now