lamy Posted January 17, 2006 Posted January 17, 2006 i have a floating DIV tag which moves along with the page, already tested it on modern browsers (with .HTM as extension, tested with IE6, NS8, Opera 8, Firefox 1.5 and Safari 1.x), it was working but it doesnt when i inserted the same code in my ASPX page. heres the same html page im using <html> <script language="javascript"> function moveDIV(source) { var frame = document.getElementById("floatingDIV"); var offset = 0; // IE compatible if ((document.all?true:false) == true) offset = source.scrollTop; else offset = document.body.scrollTop; frame.style.top = offset; } </script> <body OnMouseMove="moveDIV(this)"> <div id="floatingDIV" style="position:absolute"> This is the floating DIV </div> <p>-</p><p>-</p><p>-</p><p>-</p><p>-</p><p>-</p><p>-</p><p>-</p><p>-</p><p>-</p> <p>-</p><p>-</p><p>-</p><p>-</p><p>-</p><p>-</p><p>-</p><p>-</p><p>-</p><p>-</p> </body> </html> there seems to be a problem with document.getElementById but it is client-side, it shouldnt affect my ASP.Net page or theres something that i should be doing to make it work, anyone? Quote slow down when you need to hurry, stop when you need to move on, look back when you need to forget, or you might slip and leave sanity
bri189a Posted January 17, 2006 Posted January 17, 2006 What does the markup for the aspx page look like? Also if((document.all?true:false)==true) {} else {} is the same as: if(document.all) {} else {} Quote
lamy Posted January 17, 2006 Author Posted January 17, 2006 the ASPX page is almost the same except for the head part <%@ Page Language="VB" AutoEventWireup="false" CodeFile="WebForm1.aspx.vb" Inherits="WebForm1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>WebForm1</title> </head> <script language="javascript"> function moveDIV(source) { var frame = document.getElementById("floatingDIV"); var offset = 0; // IE compatible if ((document.all?true:false) == true) offset = source.scrollTop; else offset = document.body.scrollTop; frame.style.top = offset; } </script> <body OnMouseMove="moveDIV(this)"> <div id="floatingDIV" style="position:absolute"> This is the floating DIV </div> <p>-</p><p>-</p><p>-</p><p>-</p><p>-</p><p>-</p><p>-</p><p>-</p><p>-</p><p>-</p> <p>-</p><p>-</p><p>-</p><p>-</p><p>-</p><p>-</p><p>-</p><p>-</p><p>-</p><p>-</p> </body> </html> Quote slow down when you need to hurry, stop when you need to move on, look back when you need to forget, or you might slip and leave sanity
lamy Posted January 17, 2006 Author Posted January 17, 2006 (edited) saw the problem, its in DOCTYPE tag, i guess id have to find a way to make it compatible, as a work around, i removed the DOCTYPE tag. Edited January 17, 2006 by lamy Quote slow down when you need to hurry, stop when you need to move on, look back when you need to forget, or you might slip and leave sanity
bri189a Posted January 17, 2006 Posted January 17, 2006 Just change your DOCTYPE tage to the following: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> Quote
lamy Posted January 19, 2006 Author Posted January 19, 2006 tnx bri189a Quote slow down when you need to hurry, stop when you need to move on, look back when you need to forget, or you might slip and leave sanity
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.