+ Reply to Thread
Results 1 to 5 of 5

Thread: Javascript Resizing

  1. #1
    garrettroyce's Avatar
    garrettroyce is offline Generally Helpful Member garrettroyce is a glorious beacon of lightgarrettroyce is a glorious beacon of light
    Join Date
    Apr 2008
    Location
    IL, USA
    Posts
    3,746

    Javascript Resizing

    I'm gonna start from scratch, because all I've gotten is errors so far :P

    Example html:
    Code:
    <html>
    <body>
    <div name="d">Test</div>
    <button onclick="resize_div()">Button</button>
    </body>
    Ok, with this I want to resize the div using the onclick event. That's it. Why can't I do this?
    gjr.gr - coming soon: secrets of OCD coding from a self taught tinkerer

  2. #2
    xPlozion's Avatar
    xPlozion is offline x10 Elder xPlozion is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Delaware, USA
    Posts
    872

    Re: Javascript Resizing

    post the js code so we can see what the problem may be.

  3. #3
    garrettroyce's Avatar
    garrettroyce is offline Generally Helpful Member garrettroyce is a glorious beacon of lightgarrettroyce is a glorious beacon of light
    Join Date
    Apr 2008
    Location
    IL, USA
    Posts
    3,746

    Re: Javascript Resizing

    Code:
    var d = document.getElementsByName("d"); // this works
    d.style.height = "100px"; // this does not work, error "style is undefined"
    d.style.setAttribute("height","100px"); // this does not work, error "style is undefined"
    d.clientHeight = "100px"; // this does not work
    That's it. Just trying to keep it basic after hours of pulling my hair out.
    Edit:
    Found the problem. Left out one of those pesky indexers :P

    For example, an array of radio buttons does not have a single style attribute. However, one specific radio button does.

    I wish I could close this thread and save myself some ridicule. Lesson learned
    Last edited by garrettroyce; 03-29-2009 at 10:24 AM. Reason: Automerged Doublepost
    gjr.gr - coming soon: secrets of OCD coding from a self taught tinkerer

  4. #4
    supermix is offline x10Hosting Member supermix is an unknown quantity at this point
    Join Date
    Nov 2008
    Posts
    30

    Re: Javascript Resizing

    happens to the best of us.

  5. #5
    quantum1's Avatar
    quantum1 is offline x10Hosting Member quantum1 is an unknown quantity at this point
    Join Date
    Sep 2008
    Location
    near Nashville, TN
    Posts
    68

    Re: Javascript Resizing

    The link below, with an excerpt below that, seems like it might be addressing the problem you are having.

    http://www.webmasterworld.com/forum91/4612.htm

    It seems to me that inline elements do not have a height css attribute (unlike block elements, which do have a height css attribute). If you want to use the height attribute, you will have to change the display attribute of thisnav to 'block'.
    Two rules of development:
    1) Computers work for people; People do not work for computers
    2) Maintainability is all that matters.

+ Reply to Thread

Similar Threads

  1. Making a site JavaScript dependent - pros/cons?
    By Tarzan in forum Programming Help
    Replies: 8
    Last Post: 07-11-2008, 10:08 AM
  2. drop down menus with JavaScript disabled?
    By sifaka in forum Free Hosting
    Replies: 1
    Last Post: 05-15-2008, 10:46 AM
  3. javascript and external javascript files problem
    By delon in forum Programming Help
    Replies: 6
    Last Post: 04-27-2008, 12:41 AM
  4. A question about javascript files
    By rlodge in forum Programming Help
    Replies: 6
    Last Post: 12-19-2007, 11:26 AM
  5. XML and Javascript
    By cuteboytm in forum Graphics & Webdesign
    Replies: 1
    Last Post: 09-21-2007, 10:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers