hello again guys... you have been very helpful in the past and I'm sure I can finally finish off my little site with this bit of help - hrcerqueira you esp have been helpful and i thank you. check: http://www.chrisjongkind.com/new.htm as you can see each link is opening a different .htm in an iframe. when you click again the link, its iframe closes. however, when I click on the 'close' link that is in the .htm that is in the iframe, although it does close, when you click on the link on the main page to reopen it all it says is 'hidden' in an empty iframe, and I am stuck. I just want to be able to reopen it just like you can when you first got the page. I didn't realize clicking close would have this effect, any ideas??? thanks very much to all... chris j
It's the close code in your 'newDiv.htm' and 'newDiv2.htm', if you update it to this: <a href="javascript:parent.openFrame('fr1');">close</a> Code (markup): It work's fine. (With the appropriate id of course. . .)
nice!! thanks todd that was fast and did the trick. that brings me to one more and what should be my last Q - how can I make it so that if the first iframe is open, when the second is clicked the first one is gone and ONLY the second is open, and vice versa? you know, only one at a time.... link to updated (with todd's help) is here: http://www.chrisjongkind.com/new.htm thanks again all!!
Should be simple enough I, I wouldn't recommend a loop, so that you can make this dynamic and add more without having to change your code. . . So here is what I would suggest: <script type="text/javascript"> var lastOpen = ""; function closeLastOpen(){ if(lastOpen){ lastOpen.style.visibility = "hidden"; } } function openFrame(frm) { var openFrame = document.getElementById(frm); if ( openFrame.style.visibility == "hidden" ) { closeLastOpen(); openFrame.style.visibility = "visible"; lastOpen = openFrame; }else{ closeLastOpen(); openFrame.style.visibility = "hidden"; } } </script> Code (markup): This new code keeps track of the last frame that you opened, then closes it if another frame try's to open.
todd, you saved me....all works well now and I can move ahead with my little project....thanks a ton!!!