I'd be surprised if this isn't a FAQ; if it is, I must be searching on
the wrong keywords because I can find a lot of stuff about "how do I
make a div stick to the same area of the screen while the user scrolls
around" but what I want to do should be substantially simpler. I hope.
What I have so far works, but my new element just flows where it
normally would if it were at the end of the BODY and I'd like to be
able to get it to "float over" the rest of the page.
<html>
<head>
<title></title>
</head>
<body>
<script>
function test() {
var div = document.createElement('DIV')
div.style.position = 'absolute'
div.style.left = div.style.typ = '20px'
var h = document.createElement('H3')
h.appendChild(document.createTextNode('text'))
div.appendChild(h)
document.body.appendChild(div)
}
</script>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed eu
neque.
Duis lacinia volutpat lacus. Sed rutrum, nulla ac nonummy venenatis,
orci metus adipiscing ipsum, volutpat bibendum sapien nunc a purus.
<p>
<a href=javascript:test()>click here</a>
</body>
</html>
-Jonathan