Results 1 to 8 of 8

Thread: Anybody Know a little javascript?

  1. #1

    Thread Starter
    Hyperactive Member Rocketdawg's Avatar
    Join Date
    Feb 2003
    Location
    Back in the doghouse
    Posts
    294

    Anybody Know a little javascript?

    Hi Everyone

    I've got a couple of absolutely positioned div's that frame a page. The one on the left has tables that display images. The one on the right is purely for decoration

    I'd like them to be roughly the same size, so I created a little function:

    Code:
    <script language="javascript">
    		function resizeme()
    		{
    		x=document.getElementById("photostrip").style.height
    		y=document.getElementById("polish")
    		y.style.height=x
    		}
    		</script>
    When I try this:
    Code:
    <script language="javascript">
    		function resizeme()
    		{
    		x=document.getElementById("photostrip").style.height
    		y=document.getElementById("polish")
    		y.innerHTML=eval(x)
    		}
    		</script>
    y prints as undefined.

    My javascript skills are close to nil . Can anyone shed some light on what I need to do?

    Thanks

  2. #2
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: Anybody Know a little javascript?

    Couldn't you set all the size info up at design time?

  3. #3

    Thread Starter
    Hyperactive Member Rocketdawg's Avatar
    Join Date
    Feb 2003
    Location
    Back in the doghouse
    Posts
    294

    Re: Anybody Know a little javascript?

    wild_bill

    The div's are layered over the main table. As a general rule, I never set heights, only widths. I've added <br>'s to get the elements approximately the same height.

    I wasn't sure if there was a way to size them on load.

    Anyway, I created graphics to do the job (caulk and paint - make it what it aint). One of these days I'll get a javascript/dom reference ......If you know a good one, please let me know.

    Thanks

  4. #4
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    Re: Anybody Know a little javascript?

    putting both the the divs in a two columns of a table and setting their heights to 100%, I guess would get you 2 divs with same heights

  5. #5

    Thread Starter
    Hyperactive Member Rocketdawg's Avatar
    Join Date
    Feb 2003
    Location
    Back in the doghouse
    Posts
    294

    Re: Anybody Know a little javascript?

    veryjonny

    I was thinking that onload (when its rendered in the browser) there would be a height somewhere to retrieve. I guess if the element doesn't have it set, there's nothing to retrieve - darn, would have been too easy.

    Heights always seem a bit quirky. Anyway, the client was happy with the design, so I'm pushing on.

    Thanks

    BTW if anyone wants a great intro to javascript/DOM, check out
    yourhtmlsource
    and DHTML Utopia from SitePoint books is very helpful.

  6. #6
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Re: Anybody Know a little javascript?

    Quote Originally Posted by Rocketdawg
    wild_bill

    As a general rule, I never set heights, only widths. I've added <br>'s to get the elements approximately the same height.
    So you won't use the most commonly accepted and used means of setting a height by using CSS's .height property, but rather you implement traditional line break (<br>) tags to fluge the height.

  7. #7

    Thread Starter
    Hyperactive Member Rocketdawg's Avatar
    Join Date
    Feb 2003
    Location
    Back in the doghouse
    Posts
    294

    Re: Anybody Know a little javascript?

    nemaroller

    So you won't use the most commonly accepted and used means of setting a height by using CSS's .height property, but rather you implement traditional line break (<br>) tags to fluge the height.
    Well, it sounds so awful when you put it that way! >>a brief moment to defend myself --> I do make extensive use of linked & @import stylesheets, and the question wasn't really about the virtues of CSS.

    The question was really this: If I don't set a height property, is the actual, "in the client browser", rendered height accessible through js or vb.net ? I just want to avoid design break.

  8. #8
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Re: Anybody Know a little javascript?

    I doubt it would be accessible via someElement.style.height if you didn't explicitiy set it via CSS. The height it renders on the screen is unknown. There may be something to read on someElement.offsetHeight though without an explicitly set height.

Posting Permissions

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



Click Here to Expand Forum to Full Width