SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Error HElp

  1. #1
    SitePoint Evangelist
    Join Date
    Mar 2005
    Posts
    523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Error HElp

    Hi Guys

    The Javascript code below gives an error when checking in Firefox Javascript console

    Code:
    <SCRIPT language=JavaScript>
    <!-- Begin
    function expandingWindow(website) {
    var windowprops='width=100,height=100,scrollbars=yes,status=0,resizable=0'
    var heightspeed = 10; // vertical scrolling speed (higher = slower)
    var widthspeed = 10;  // horizontal scrolling speed (higher = slower)
    var leftdist = 10;    // distance to left edge of window
    var topdist = 10;     // distance to top edge of window
    
    if (window.resizeTo&&navigator.userAgent.indexOf("Opera")==-1) {
    var winwidth = 800;
    var winheight = 600;
    var sizer = new Object(                                                               );
    for (sizeheight = 1; sizeheight < winheight; sizeheight += heightspeed)
    sizer.resizeTo("1", sizeheight);
    for (sizewidth = 1; sizewidth < winwidth; sizewidth += widthspeed)
    sizer.resizeTo(sizewidth, sizeheight);
    sizer.location = website;
    }
    else
    new Object(                   );
    }
    //  End -->
    </SCRIPT>
    The error is that sizer.resizeTo is not a function.The highlighted line above

    Please help
    Niva

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,152
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    The resizeTo method resizes "windows" but your code is applying it to an "object".
    Is there any way to specify that sizer is a window object?

  3. #3
    SitePoint Evangelist
    Join Date
    Mar 2005
    Posts
    523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mittineague
    The resizeTo method resizes "windows" but your code is applying it to an "object".
    Is there any way to specify that sizer is a window object?
    HI

    Thanks for the reply Here is how I call the script,is it incorrect.

    Code:
    <input type="button" name="customer" value="  Customer / Agent Report " onClick="expandingWindow('doAgent.php')">
    Please help
    Niva

  4. #4
    SitePoint Zealot coothead's Avatar
    Join Date
    Jan 2005
    Location
    Chertsey, London, England
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi there nivashni,

    does this help...
    Code:
    <script type="text/javascript">
    <!-- 
    function expandingWindow(website) {
       windowprops='width=100,height=100,scrollbars=yes,status=0,resizable=0';
       heightspeed=10; // vertical scrolling speed (higher = slower)
       widthspeed=10;  // horizontal scrolling speed (higher = slower)
       leftdist=10;    // distance to left edge of window
       topdist=10;     // distance to top edge of window
       obj=window.open();
    if(window.resizeTo&&navigator.userAgent.indexOf('Opera')==-1) {
      winwidth=800;
      winheight=600;
      sizer=new Object(obj);
    for(sizeheight = 1;sizeheight<winheight;sizeheight+=heightspeed) {
       sizer.resizeTo('1',sizeheight);
     }
    for(sizewidth=1;sizewidth<winwidth;sizewidth+=widthspeed) {
       sizer.resizeTo(sizewidth,sizeheight);
       sizer.location=website;
      }
     }
    else {
       new Object(obj);
      }
     }
    //-->
    </script>
    
    coothead


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •