473,811 Members | 4,039 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Body onscroll, scrollTop, scrollLeft not working with master pages ???

I have a weird problem. I'm using a master page to hold a menu that I
want to scroll as the user scrolls in the browser window so it will
always be visible. First off, putting onsroll in the body tag of my
master page does nothing. Oh, IE is the browser.

<body onscroll="alert ('scrolling')">

I was able to get around this setting an event hander for
window.onscroll . However, body.scrollTop is always 0! I wrote a plain
aspx test file to make sure I wasn't losing my mind and it worked
perfectly. Here is the code for the test file...
.....
<script language="javas cript">
function movediv()
{
//document.all.di v1.style.top=do cument.body.scr ollTop;
alert(document. body.scrollTop) ;
}

</script>
</HEAD>

<body onscroll="moved iv()">
<form id="Form1" method="post" runat="server">
<div id="div1" style="position :absolute">This is a div</div>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br
/>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br
/>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br
/>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br
/>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br
/>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br
/>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br
/>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br
/>
</form>
</body>
</HTML>

In my .master page I'm basically doing this

.....
<body>
<table>
<tr>
<td>
<div id="divMenu" style="position :absolute">menu buttons
here</div>
</td>
<td>
<asp:contentpla ceholder ....
</td>
</tr>
</table>

<script language=javasc ript>
window.onscroll =scrolldiv;

function scrolldiv()
{
document.all.di vMenu.style.top =document.body. scrollTop;
}

</script>

body.scrollTop is always 0!!! I checked scrollLeft and it is always 0
as well! I also tried adding a button that just alerts the scrolltop
value which is also 0. And yes, I the page was scrolled down so 0 is
an invalid value.

I've been searching for an answer to this for hours and have found
nothing. Does anyone have a clue?

TIA,
Greg

Dec 29 '05 #1
0 2738

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
10489
by: viza | last post by:
Hi! I use the onscroll event to make something like the CSS position:fixed; for MSIE. In MSIE/5.5, before a function is assigned to the event handler, it has the value null. In Opera, it is undefined, because Opera doesn't support this event. I use:
2
9351
by: London Boy | last post by:
Hi, i've done a script that makes a DIV appear and follow the mouse cursor and it works fine but, it has a small glitch, when i scroll the document, the DIV doesn't appear beside the cursor but much higher on the page. In the function that shows the DIV for the first time, the document.body.scroll... doesn't work, they always return 0, though it works on a website i visited... any clues? (IE) In the A tags of links ->...
2
4442
by: Earl Teigrob | last post by:
I am trying to build a custom control to wrap my smart navigation implimention (not microsofts 'cause it has problems) The follow code works fine when the onclick and onload events are defined in the Body tag. However, when I try to set them in Javascript code, I get errors. What am I doing wrong??? **********THIS WORKS ************ <html>
5
20290
by: sam | last post by:
Hi all, I am using documnet.body.scroll to disable the window scroll bar. This works in IE only and not other browsers. Can any one tell me if there is any such method which is cross browser compatible. Thanks, sam
1
1967
by: PCK | last post by:
My goal is to populate the body element so that I can add an onkeydown event. <body onkeydown='x();'></body> I am currently using master/content pages. I do not want this function on every page using my master page. I want to be able to decide what pages get this function on a page by page basis. Because of this I cannot just add the text to the html side of the master page as it would cause unwanted results on the pages where I do...
0
2663
by: bluegrasslover | last post by:
I've gotten a couple of emails about this problem lately so I'm going to post the solution that someone emailed me a while back. When you create a master page visual studio automatically adds a <-- doctype ... statement near the top of the master page. Somehow this forces some w3c standard where scrolltop isn't supported. I removed the doctype declaration from my masterpage and everything works fine. Actually I changed the dtd type to...
2
14657
by: =?Utf-8?B?SGFyZHkgV2FuZw==?= | last post by:
Hi all, I created a complex ASPX page, nested inside a master page and Ajax UpdatePanel. In one of my Javascript function I need to capture mouse position. I use alert(document.body.scrollTop) to test scroll bar position. Even though I have a long scroll bar and already to end of the page, when I call this function, I always get "0" as document.body.scrollTop. Meanwhile I created a very simple HTML page with a lot of <brto test, it...
0
10644
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10394
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7665
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6882
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5552
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3863
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.