Problem with JavaScript
I have problem experience with JavaScript, especially for refreshing or loading pages in frames. For better illustrations, I put the scenario below.
I have a container page (Window1) and 2 frames on it. I used WinLIKE so they are not frames actually, but windows. Window2 is a menu window and Window3 is for the content. The Window3 is for displaying the content regarding which menu we choose in Window2 (menu). We can simply write a link in Window2 and target it to Window3.
But the problem comes when I need the fourth window (Window4) appear from Window3. Please see the image below.
The Window4 is a popup window for editing the value or content of Window3. As the editing finished, Window4 should update the content of Window3 and close itself. The first cycle is work perfectly. But when I navigate to the other link in Window2 (menu), the problem comes.
I can show up the Window4 via link/button from Window3. But when I finish editing, Window4 can not refresh the Window3 nor close itself. I though it was the broken “ownership” of the windows. Or the child-windows can not recognize the “parent” or “top” window. Yes, I finally believe the problem because of it. But why?
I don’t want to know how it comes because I have experience it on 2 different browser, IE and FF. So maybe the problem not comes from the browser, but from the Javascript.
Solving…
Finally after working and thinking sometimes, I can solve the problem. It’s trivia actually. But when I just a beginner for Javascript, I feel it as a big problem.
To keep the ownership or parenting of the frames/windows, I need to refresh, reload or loading URL on Window3 via Window1 (container). So, every link on Window2 (menu) that need change the content of Window3, it should always done via Window1 (container). I need some javascript function in Window1 to update Window3. The first is for refresh/reload the content of Window3 and the second is for changing the URL of window3. I should always call these functions from Window2 to change Window3.
And the Window3 can manage the popup (Window4) by itself without worry losing the parentship. And finally the popup window (Window4) can always update Window3 and close itself.
By now I’m very happy with the solution. My web-application works fine.
No comments yet
Leave a reply

