Sriram
Sriram

Reputation: 2999

Getting the current iframe's body reference in JavaScript

I'm working on modal windows. When I click on a hyperlink in the main page, I need to show a modal window. This modal window I prepared using divs and one iframe. iFrame is used to show the source. Now in this modal window, I have another hyperlink to click which again opens a new modal window. This goes on.

Every time when I click on hyperlink, i want to create a new modal window in that provided iframe's src file itself. How to achieve this ?

TIA.

modal windows to built

Upvotes: 1

Views: 155

Answers (1)

Ravindra Gullapalli
Ravindra Gullapalli

Reputation: 9158

You can achieve this by using a simple java script file which creates div and iframe in your pages and frames. This script file will have all the necessary methods and a class to access these methods separately in each of the frame.

For example you can have the script file like

MyClass = function(){
 this.var1, this.var2; // To store values separately in each frame.
 this.myMethod = function(){
      // Function body
 }
}

Upvotes: 1

Related Questions