<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d13376580\x26blogName\x3dThe+GeekWithin\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttps://geekwithin.blogspot.com/search\x26blogLocale\x3den_US\x26v\x3d2\x26homepageUrl\x3dhttp://geekwithin.blogspot.com/\x26vt\x3d-8111287070889316650', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

The GeekWithin

Monday, June 06, 2005

The under-used IFRAME tag

How many of you out there use the IFRAME tag? Do you even know what it is?

If you have never looked at it before, the first thing you need to check out is the W3C specification. The IFRAME, or Inline Frame, allows you to put a frame in the middle of the page!

How is this useful? For those of you who like graphics ladden websites, this allows a graphical border the completely surrounds your frame. The frame itself will have a scroll bar, just like other frames.

I have found it useful lately in avoiding Event Handler hell. I have a page with a user control, that has a second imbedded control inside the first and one more inside of that. It makes sense in how the data relates and the UI needs to interact with the data, but it means that button clicks must have Events that are captured at the higher level pages and passed down to the last embedded control. I have still not found an EASY way to do this, so my answer was an Inline Frame.

By moving my code into a seperate frame, poof, new same level Event Handlers for all interactions I need to make. Ah, the blissfulness it has brought is worth it... plus it looks good.

I'm curious how often this frame type is used, and how others have utilized it.


Creative Commons License  This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.