|
-
Jul 8th, 2005, 02:22 PM
#1
Thread Starter
Hyperactive Member
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
-
Jul 8th, 2005, 05:09 PM
#2
Re: Anybody Know a little javascript?
Couldn't you set all the size info up at design time?
-
Jul 8th, 2005, 09:38 PM
#3
Thread Starter
Hyperactive Member
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
-
Jul 12th, 2005, 01:53 PM
#4
PowerPoster
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
-
Jul 12th, 2005, 04:59 PM
#5
Thread Starter
Hyperactive Member
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.
-
Jul 15th, 2005, 08:48 PM
#6
I wonder how many charact
Re: Anybody Know a little javascript?
 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.
-
Jul 16th, 2005, 12:17 PM
#7
Thread Starter
Hyperactive Member
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.
-
Jul 18th, 2005, 03:55 PM
#8
I wonder how many charact
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|