Advertisement

10.13.2008 at 05:23PM PDT, ID: 23811357
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

Javascript & IFrame - Read content URL?

Asked by frosty5656 in JavaScript, Hypertext Markup Language (HTML), Dynamic HTML (DHTML)

Tags:

Hello:

I am working with Javascript and IFrames.

I have a single web page with a single IFrame. There are several links that can be clicked to display content within the IFrame.

What I would like to do is that if a user clicks a link it will display the IFrame content. If the user clicks the same link again and the IFrame is already displayed, it will hide the frame. However, if the user clicks a different link the content will change and the frame will remain being displayed.

I have already completed this task, however, I had to change some code in order for the browsers 'back' button to function properly.

Here is the code:

function Hide(frameid) {

      var frm = document.getElementById(frameid);
      var url = frm.src;

      if(frm.style.display=='none') {
            frm.style.display='block';          
            frm.contentWindow.location.replace('testpage1.html');                    
      } else {            
            if(ulr=='testpage1.html') {
                     frm.style.display='none';
            } else {
                   frm.style.display='block';          
                      frm.contentWindow.location.replace('testpage1.html');  
               }
      }
      
etc...

}

The problem is that i have to use:

" fmr.contentWindow.location.replace('testpage1.html'); "

 instead of just

" frm.src = 'testpage1.html';

The reason being is that I want the browsers 'back' button to not navigate the pages within the IFrame.
If I try to evaluate frm.src after using the replace feature it will return null. For some reason I am unable to evaluate the frames src at all after using the replace feature. This being so it is preventing me from knowing what content is being displayed.

Any suggestions would be appreciated.

Thanks
Start Free Trial
[+][-]10.13.2008 at 10:04PM PDT, ID: 22708702

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: JavaScript, Hypertext Markup Language (HTML), Dynamic HTML (DHTML)
Tags: Javascript
Sign Up Now!
Solution Provided By: sh0e
Participating Experts: 2
Solution Grade: A
 
 
[+][-]10.14.2008 at 02:22PM PDT, ID: 22716114

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628