48 users online (1 members and 47 guests)  


  Results 1 to 3 of 3

Related

  1. Passing value from parent window to child window    Forum: Javascript Forum
    Replies: 0
  2. Replies: 1
  3. Web page fitting all screen sizes.    Forum: HTML Forum
    Replies: 3
  4. Replies: 5
  1. #1
    ACiD's Avatar
    New User

    Status
    Offline
    Join Date
    Feb 2001
    Posts
    1

    Question fitting window to table

    Hi there,

    I want to resize a window to fit an image... unless this image's width is smaller than a table (where i put my buttons in), then the window has to resize to the table's width.

    I already found a way to do this but have to give the table a name ... how can i do this ? ( I already tried the tag <table width="280" border="0" cellspacing="0" cellpadding="0" NAME="table1">, this didn't work)

    Here's the piece of JS-code where it should happen :
    if (document.images['Image1'].width < document.all.Table1.width)
    {x = document.all.Table1.width} else {x = document.images['Image1'].width};
    y = document.images['Image1'].height + 150;
    window.resizeTo(x,y);

    does this work...document.all.Table1.width ?

    Thanks.


    ------------------
    -=ACiD=-

  2. #2
    PHPboy's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Jun 2001
    Location
    Australia
    Posts
    29

    Post

    Originally posted by ACiD:
    ( I already tried the tag <table width="280" border="0" cellspacing="0" cellpadding="0" NAME="table1">, this didn't work)
    from what I can see, all you need to do is to name the table "Table1" not "table1" (case-sensitivity)


    Last edited by HTML; 09-10-2003 at 06:14 PM.

  3. #3
    Brothercake's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2001
    Posts
    10

    Post

    The reference document.all ... is to the element's ID, not its name. The table should be

    <table width="280" border="0" cellspacing="0" cellpadding="0" id="Table1">

    However I warn against doing this - it is not polite to force-resize a user's browser window; I would not visit a site that did that to me.



Tags for this Thread