• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1492
  • Last Modified:

window.resizeTo('550','650') does not work with firefox

Hi,
I'm trying to resize a pop-up window after with window.resize('550', '650')
IE works fine, but Firefox is not working.
any Ideas ?

I trimmed the code is it will be easier to spot the problem

function changePopUpSize(elementId){
    //Some code...  
    //alert(ObjCount);
    if(ObjCount == 2){
      resizeTo('381','800');
    }else{
      //Some code...  
      resizeTo('550','650');
                //Some code...  
   }
}

I already tried window.innerHeight / window.innerWidtht, no luck so far

Thank you in advance,
Jack
0
luxurylink
Asked:
luxurylink
  • 2
1 Solution
 
0h4crying0utloudCommented:


Your code is working fine for me in IE and FF.  can you post more code?  I've seen FF choke on some legacy code that get elements by names or IDs with out using document.getElementById().
0
 
Pravin AsarCommented:
Here is a simple example which is cross-browser.

In IE, the you need to add (to take care of border, statusbar, toolbar etc.)

<html>
<head>
<title>Resize Document</title>
<script language="javascript">
function ToggleSize (myWidth, myHeight) {
var width = myWidth;
var height = myHeight;
if (document.all) {
    width  += (10);
    height += (42);
    window.resizeTo(width, height);
    window.moveTo(0,0);
}
else {
    window.innerHeight = height;
    window.innerWidth = width;
    window.moveTo(0,0);
}
return false;
}
</script>
</head>

<body>
<a href="#" onclick="return ToggleSize(800, 600); ">Resize to 800 x 600</a>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" onclick="return ToggleSize(600, 400); ">Resize to 600 x 400</a>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" onclick="return ToggleSize(400, 300); ">Resize to 400 x 300</a>

<br>
<a href="#" onclick="window.open (window.location.href, '', 'width=800, height=600, toolbar=no, status=no'); return false;">Open New </a>
</body>
</html>
0
 
luxurylinkAuthor Commented:
Ok, here is the entire function, there are some objects that I play around with, but what's not working for me is that the window is not resizing...

function changePopUpSize(elementId){
            var showcaseSponsor = document.getElementById(elementId);
            ObjCount = 0;
            for (i=0; i < showcaseSponsor.childNodes.length; i++){
                  if (showcaseSponsor.childNodes[i].hasChildNodes() && showcaseSponsor.childNodes[i].childNodes[0].nodeName == "IMG" && showcaseSponsor.childNodes[i].childNodes[0].width == 1){
                        showcaseSponsor.removeChild(showcaseSponsor.childNodes[i]);
                        
                        var skyScraperAd = document.getElementById("skyScraperAd");
                        for (i=0; i < skyScraperAd.childNodes.length; i++){
                              if (skyScraperAd.childNodes[i].hasChildNodes()){
                                    skyScraperAd.removeChild(skyScraperAd.childNodes[i]);
                              }
                        }
                        
                        skyScraperAd.removeChild(skyScraperAd.childNodes[0]);
                        ObjCount += 1;
                  }
            }
            //alert(ObjCount);
            if(ObjCount == 2){
                  resizeTo('381','800');
            }else{
                  document.getElementById("skyScraperAd").style.display = "block";
                  document.getElementById("showcaseSponsor").style.height = "150px";
                  document.getElementById("showcaseSponsor").style.paddingBottom = "12px";
                  resizeTo('550','650');
                  //window.innerWidth = "550px";
                  //window.innerHeight = "650px";
                  //window.moveTo(0,0);

                  var showcaseExclusiveSponsor = document.getElementById("showcaseExclusiveSponsor");
                  for (i=0; i < showcaseExclusiveSponsor.childNodes.length; i++){
                        if ((showcaseExclusiveSponsor.childNodes[i].hasChildNodes() && showcaseExclusiveSponsor.childNodes[i].childNodes[0].nodeName == "IMG")||(showcaseExclusiveSponsor.childNodes[i].nodeName == "OBJECT")){
                              showcaseExclusiveSponsor.removeChild(showcaseExclusiveSponsor.childNodes[i]);
                        }
                  }
            }
      }
0
 
Pravin AsarCommented:
Look at the my post, do not use ' (quote) for the parameter values,

Also in you your code resizeTo ()  method need to know about  window object

 
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now