Mam problem ponieważ mój kod mi nie działa i nie wiem gdzie jest błąd.
Co chce zrobić? Aby moja grafika zawsze była w tym samym miejscu nie zależnie od pozycji scrolla.
Kod
<html>
<head>
<title></title>
<script type="text/javascript>
window.onload = function() {
document.getElementById('div_layer').onscroll = function() {
document.getElementById('div_layer').style.top = div.scrollTop;
document.getElementById('div_layer').style.left = div.scrollLeft;
}
}
</script>
</head>
<body>
<div id="div_layer" style="position: absolute; left: 400; top: 100; width: 200; height: 200; z-index: 1; visibility: visible;">
<img src="st.JPG">
</div>
</body>
</html>
<head>
<title></title>
<script type="text/javascript>
window.onload = function() {
document.getElementById('div_layer').onscroll = function() {
document.getElementById('div_layer').style.top = div.scrollTop;
document.getElementById('div_layer').style.left = div.scrollLeft;
}
}
</script>
</head>
<body>
<div id="div_layer" style="position: absolute; left: 400; top: 100; width: 200; height: 200; z-index: 1; visibility: visible;">
<img src="st.JPG">
</div>
</body>
</html>