Manuel
|
| Posted: 03/03/2005, 6:34 PM |
|
I would apprecite if somebody tell me some hints about using frames with CCS.
Thanks,
Manuel
|
|
|
 |
Nicole
Posts: 586
|
| Posted: 03/04/2005, 2:42 AM |
|
Manuel,
I recommend you to refer to this discussion http://forums.codecharge.com/posts.php?post_id=20583
it looks pretty useful
_________________
Regards,
Nicole |
 |
 |
mrincon
Posts: 14
|
| Posted: 03/08/2005, 7:01 PM |
|
Thanks a lot, Nicole. I've been checked it. I don't know if the Hamilton's solution wich is for ASP applies to PHP
_________________
Manuel Rincon
Colombia |
 |
 |
dataobjx
Posts: 181
|
| Posted: 03/10/2005, 5:21 AM |
|
Dynamic Drive has a very good Frames script which I am providing below.
The nice thing about this script is that it dynamically adjusts the height of the frame. As a result - one doesn't get the double vertical scroll bar that sometimes/often otherwise occurs.
Let's say you have your normal "default.asp/php" page.
1) Add the jsScript below between the <head></head> section.
<script type="text/javascript">
/***********************************************
* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/
//"<iframe id=""myframe"" src=""externalpage.htm"" scrolling=""no"" marginwidth=""0"" marginheight=""0"" frameborder=""0"" vspace=""0"" hspace=""0"" style=""overflow:visible; width:100%; display:none""></iframe>"
//As you can see, you can specify more than one iframe on the page in which the script should dynamically resize.
//Secondly, for the code of Step 2, be sure the ID (ie: "myframe") matches the ID entered into the script,
//so the script knows which IFRAMEs to adjust.
//You may also change the width attribute (ie: 100%) to a different value, as the script
//only changes the height of the iframe, but not the width.
//Thirdly, in the script of Step 1, there is a variable that toggles whether browsers
//that don't support this script (non IE5+/NS6+) should still see the iframe(s) or not.
//Generally you should choose to hide the iframe in these non compatible browsers
//(Opera 7 included), as the iframe's height is hardwired in these cases, and part of
//the external page most likely will be clipped and unviewable to the viewer if the
//external page's height exceeds the iframe's default height.
//Last but not least, as shown in the demo above, you can actually use links on your
//main page to load a page into your IFRAME (with the IFRAME automatically resized
//to that page's height of course). To do so, the link should look like this:
//<a href="javascript:loadintoIframe('myframe', 'external.htm')">Link</a>
//where "myframe" is the ID of the IFRAME you wish to load a page into, and
//"external.htm", the path to the page on your site to load.
//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["MainIFrame"]
//Should script hide iframe from browsers that don't support this script
//(non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"
var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=getFFVersion>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers
function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids)
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids] : document.getElementById(iframeids)
tempobj.style.display="block"
}
}
}
function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight;
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}
function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}
function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}
if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller
</script>
2) Add a label, set it to output HTML and create the BeforeShow event.
In this instance, the name of the label (and the frame) is "MainIFrame"
Function MainIFrame_BeforeShow() 'MainIFrame_BeforeShow @2-6E3B3D86
'Custom Code @3-73254650
' -------------------------
' Write your own code here.
Dim sResult
Dim sWEBPage
sWEBPage = "somepage.asp"
sResult = "<iframe id=""MainIFrame"" name=""MainIFrame"" src=""" & sWEBPage & """ scrolling=""no"" marginwidth=""0"" marginheight=""0"" frameborder=""0"" vspace=""0"" hspace=""0"" style=""overflow:visible; width:100%; display:none""></iframe>"
MainIFrame.value = sResult
' -------------------------
'End Custom Code
End Function 'Close MainIFrame_BeforeShow @2-54C34B28
The example code above is of course asp so, if you're using PHP you'll have to translate a bit - but it will work...
Also, I've used the before show event because many of our applications load different pages according to the users permissions, etc. Thus, - sWEBPage = "somepage.asp" - may be a different load page from user to user....
But one doesn't have to use the label & BeforeShow event as mentioned but rather can use pure html if one requires a static IFrame page load.
Hope this helps. Refer to the DynamicDrive example for the original code.
_________________
www.DataObjx.net
www.mydigitalapps.com |
 |
 |
|