JavaScript - Resize iFrame

Status
Not open for further replies.

nunoabc

New Member
Messages
151
Reaction score
0
Points
0
Hi!

So this is my javascript:
Code:
<script type="text/javascript">
var winH = 400;
if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winH = window.innerHeight;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winH = document.body.offsetHeight;
 }
}
winH = winH-142;
document.write('<iframe name="I1" id="I1" marginwidth="1" marginheight="1" height="'+winH+'" width="100%" src="/inicio/index.php" border="0" frameborder="0">This is a iFrame.</iframe>');
</script>
I want this to be able after a second or two (until the user goes away) to repeat the script, but I don't know how to do it. If anyone can do it and it's working on every browser, I'll pay 400 credits.
________________________________________

I've got it now. Who wants to know the browser, adapt this script.
Code:
function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  window.alert( 'Width = ' + myWidth );
  window.alert( 'Height = ' + myHeight );
}

Not made by me. Source: JavaScript tutorial - Window size and scrolling
________________________________________

Could some administrator lock this thread? I know how to do it but I can't. The option doesn't appear to me...
 
Last edited:
Status
Not open for further replies.
Top