| edelhart@manateebay.com 2006-02-28, 6:21 pm |
| I have a layer with a scrollbar and I want to have it scrolled to a
specific place when the page loads. I would ideally want to do this
with CSS, but if I have to, with JS. Any ideas?
**************** CODE **********************
<style>
..dal_groupset_list
{
overflow: scroll;
height: 120px;
}
</style>
<div class="dal_groupset_list" id="<{$dal_form }>_dal_groupset_list"
style="scrollTop: <{$dal_scroll}>">
<!--- many lines of content -->
</div>
<script language="javascript">
xoopsSetElementProp('<{$dal_form }>_dal_groupset_list',
'scrollTop',
'<{$dal_scroll}>');
function xoopsGetElementById(id){
if (document.getElementById) {
return (document.getElementById(id));
} else if (document.all) {
return (document.all[id]);
} else {
if ((navigator.appname.indexOf("Netscape") != -1) &&
parseInt(navigator.appversion == 4)) {
return (document.layers[id]);
}
}
}
function xoopsSetElementProp(name, prop, val) {
var elt=xoopsGetElementById(name);
if (elt) elt[prop]=val;
}
</script>
****************** END CODE ********************
(the <{ }> elements are server side SMARTY includes.
$dal_scroll is an integer.
$dal_form is a string.
)
|