469,904 Members | 1,956 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,904 developers. It's quick & easy.

Ajax Updatepanel and Manual scroller

Hi all !!
I have a difficult issue. I use the Manual Scroller script from dynamicDrive. This script is full working and is cross-browser. The url is for it, is http://www.dynamicdrive.com/dynamici...nualscroll.htm.
I am using a simple example. I have two updatepanels.
The first has a linkbutton inside so when I click it, I show some text in the second updatepanel. I want the scroller to contain the text of second updatepanel.
All the javascript code is inside the second updatepanel But when I run my aspx, i get two different errors: “movedown is not defined” OR “crossobj.offsetHeight is undefined”

If I remove the javascript, the aspx works perfectly.

thanks in advanced

Expand|Select|Wrap|Line Numbers
  1.  <script language="JavaScript1.2" type="text/javascript">
  2.           // script from the site http://www.dynamicdrive.com/dynamicindex2/manualscroll.htm                 
  4.                   var crossobj=document.getElementById? document.getElementById("content") : document.all.content;
  5.                    var contentheight=crossobj.offsetHeight;
  6.                    function movedown()
  7.                    {
  8.                       if (window.moveupvar) clearTimeout(moveupvar)
  9.                       if (iens6&&parseInt(crossobj.style.top)>=(contentheight*(-1)+100))
  10.                        crossobj.style.top=parseInt(crossobj.style.top)-speed+"px"
  11.                        // else if (ns4&&crossobj.top>=(contentheight*(-1)+100)) crossobj.top-=speed
  12.                        movedownvar=setTimeout("movedown()",20)
  13.                    }
  15.                    function moveup()
  16.                   {
  17.                       if (window.movedownvar) clearTimeout(movedownvar)
  18.                       if (iens6&&parseInt(crossobj.style.top)<=0)
  19.                       crossobj.style.top=parseInt(crossobj.style.top)+speed+"px"
  20.                        // else if (ns4&&crossobj.top<=0) crossobj.top+=speed
  21.                       moveupvar=setTimeout("moveup()",20)
  22.                    }
  24.                    function stopscroll()
  25.                    {
  26.                        if (window.moveupvar) clearTimeout(moveupvar)
  27.                        if (window.movedownvar) clearTimeout(movedownvar)
  28.                    }
  30.                    function movetop()
  31.                    {
  32.                        stopscroll();
  33.                       if (iens6) crossobj.style.top=0+"px";
  34.                        // else if (ns4) crossobj.top=0
  35.                    }
  37.                    function getcontent_height()
  38.                    {
  39.                        if (iens6)  contentheight=crossobj.offsetHeight;
  40.                        // else if (ns4) document.nscontainer.document.nscontent.visibility="show"
  41.                    }
  44.                   window.onload=getcontent_height();                   
  46.            </script>
Nov 24 '07 #1
1 1635
4,871 Expert 4TB
There was a lot of unnecessary code, so I removed it. As you indicated this seems to be a JS problem. I'd like to say told you so, but I won't. I believe there is a problem with calling movedown within the function, I usually use it outside when it is called. I have seen it used inside conjunction with an object so this could be a referencing error, but never had the occasion to use this myself. HTH.

Nov 24 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by =?Utf-8?B?SmFrb2IgTGl0aG5lcg==?= | last post: by
4 posts views Thread by bbawa1 | last post: by
2 posts views Thread by =?Utf-8?B?VG9u?= | last post: by
reply views Thread by Nightcrawler | last post: by
7 posts views Thread by MikeB | last post: by
1 post views Thread by =?Utf-8?B?T2xlZw==?= | last post: by
4 posts views Thread by Peter | last post: by
1 post views Thread by Mark B | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.