ifame 去滚动条

	function changeframe()
	{			
	  var workspace = document.getElementById('workspace');
		var navigator = getOs();
//让滚动条回到页面上方。
    (document.documentElement && document.documentElement.scrollTop)?document.documentElement.scrollTop=0 : document.body.scrollTop=0;    
		if("Firefox" == navigator)
		{
		  alert(workspace.height);
		  alert(workspace.width);
			workspace.height=window.frames["workspace"].document.body.scrollHeight;
			workspace.width=window.frames["workspace"].document.body.scrollWidth;
		  alert(workspace.height);
		  alert(workspace.width);			
		}
		else
		{
		  // alert(workspace.style.height);
		  // alert(workspace.style.width);		
		  		  		  
		  //alert('window.frames[workspace].document.body.scrollTop'+window.frames["workspace"].document.body.scrollTop);
		  alert('window.frames[workspace].document.body.scrollHeight'+window.frames['workspace'].document.body.scrollHeight);
		  alert('workspace.document.body.scrollHeight'+workspace.document.body.scrollHeight);
		  var height = window.frames['workspace'].document.body.scrollHeight;
		  // allPrpos(document.getElementById('content-container').style);
		  document.getElementById('regionB').style.height = height+100;
		  // allPrpos(document.getElementById('regionB').style);
			workspace.style.height = height;		
			workspace.style.width=window.frames['workspace'].document.body.scrollWidth;
			// allPrpos(workspace.style);
			document.documentElement.scrollTop = 0;
		  alert(workspace.style.height);
		  alert(workspace.style.width);		      		
		}	
	}

function allPrpos(obj) {  
    var props = ""; 
    for(var p in obj){  
        if(typeof(obj[p])=="function"){  
            obj[p](); 
        }else{  
            props+= p + "=" + obj[p] + "\t"; 
        }  
    }  
    alert(props); 
}	

function getOs()
{
    var OsObject = "";
   if(navigator.userAgent.indexOf("MSIE")>0) {
        return "MSIE";
   }
   if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){
        return "Firefox";
   }
   if(isSafari=navigator.userAgent.indexOf("Safari")>0) {
        return "Safari";
   } 
   if(isCamino=navigator.userAgent.indexOf("Camino")>0){
        return "Camino";
   }
   if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){
        return "Gecko";
   }  
}

但是如果iframe里面嵌套iframe我们该怎么办呢?请看附件

你可能感兴趣的:(firefox,Safari)