C
Catherine Lynn Smith
OK, I am learning my way around the new DOM, but I am still at a loss
on finding a few things.
I have an HTML document that links to a stylesheet.
/* START STYLESHEET EXAMPLE */
/* styles/mystyles.css */
..leftnav {
font-family: Arial, Helvetica, sans-serif;
font-size: 13pt;
font-weight: bold;
}
..leftnav A {
font-weight: bold;
text-decoration: none;
}
/* END STYLESHEET EXAMPLE */
I am using DIV/SPAN combinations to create some floating links built
into 3D layers on the webpage. For example:
<!-- START HTML SNIPPET -->
<link id="styles" href="styles/mystyles.css" rel="stylesheet"
type="text/css">
<div id="lfnav">
<span id="lflink01" style="position:absolute; left:85px; top:107px"
class="leftnav">
<a href="javascript:void(0);" onClick="getLink(foo);">Foo</a>
</span>
</div>
<!-- END HTML SNIPPET -->
Note that I am only assigning the upper left position of the
associated SPAN style. Ultimately, I am interested in dynamically
placing these based on the number and size of the links put in place.
This would mean that I would have to have a good idea what the width
and height of each DIV (after populated with text) was. I tried using
the associated
document.getElementById('lflink01').style.width
and
document.getElementById('lflink01').style.height
but they come back basically null (I used an alert and the alert came
up blank).
The other thing I considered was calculating at least the height based
on the font size. (although the former would be preferred to get
'both' dimensions) Needless to say, I am now curious how to access my
styles as well.
So this brings me to two questions:
1) Can I retreive the here-to-fore unknown width & height of the DIV
'after' it is populated with text of otherwise undetermined
dimensions.
2) How do I access the individual style elements such as fontSize
(such as the above example) where the styles are linked in a
stylesheet?
Any help is greatly appreciated!!!
Catherine Lynn
on finding a few things.
I have an HTML document that links to a stylesheet.
/* START STYLESHEET EXAMPLE */
/* styles/mystyles.css */
..leftnav {
font-family: Arial, Helvetica, sans-serif;
font-size: 13pt;
font-weight: bold;
}
..leftnav A {
font-weight: bold;
text-decoration: none;
}
/* END STYLESHEET EXAMPLE */
I am using DIV/SPAN combinations to create some floating links built
into 3D layers on the webpage. For example:
<!-- START HTML SNIPPET -->
<link id="styles" href="styles/mystyles.css" rel="stylesheet"
type="text/css">
<div id="lfnav">
<span id="lflink01" style="position:absolute; left:85px; top:107px"
class="leftnav">
<a href="javascript:void(0);" onClick="getLink(foo);">Foo</a>
</span>
</div>
<!-- END HTML SNIPPET -->
Note that I am only assigning the upper left position of the
associated SPAN style. Ultimately, I am interested in dynamically
placing these based on the number and size of the links put in place.
This would mean that I would have to have a good idea what the width
and height of each DIV (after populated with text) was. I tried using
the associated
document.getElementById('lflink01').style.width
and
document.getElementById('lflink01').style.height
but they come back basically null (I used an alert and the alert came
up blank).
The other thing I considered was calculating at least the height based
on the font size. (although the former would be preferred to get
'both' dimensions) Needless to say, I am now curious how to access my
styles as well.
So this brings me to two questions:
1) Can I retreive the here-to-fore unknown width & height of the DIV
'after' it is populated with text of otherwise undetermined
dimensions.
2) How do I access the individual style elements such as fontSize
(such as the above example) where the styles are linked in a
stylesheet?
Any help is greatly appreciated!!!
Catherine Lynn