Solved

I want my textbox to move as I scroll down the page is this possible with vb.net?

Posted on 2004-10-11
8
238 Views
Last Modified: 2010-04-23
I want my textbox to move as I scroll down the page is this possible with vb.net?

If not could someone give me the code that does this?

Suppose I have textbox id=txt1 , I simply want it to either scroll as I scroll or appear not to move as I scroll. Either method will be appreciated.

Kind Regards

Paul G
0
Comment
Question by:pgilfeather
  • 4
  • 3
8 Comments
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 12274716
web or winforms ?
0
 

Author Comment

by:pgilfeather
ID: 12274954
web
0
 
LVL 18

Accepted Solution

by:
tusharashah earned 500 total points
ID: 12277472
Where Exactly are you showing your Clock?

<div id="divTopRight"    style="position:absolute">
--> In your HTML code Put your textbox that display Clock in here
</div>

After this </div> element Past following code
---------------------------------------------------------------------------------------------------------------------------------------
<script type="text/javascript">
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
var px = document.layers ? "" : "px";
function JSFX_FloatDiv(id, sx, sy)
{
     var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
     window[id + "_obj"] = el;
     if(d.layers)el.style=el;
     el.cx = el.sx = sx;el.cy = el.sy = sy;
     el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;};
     el.flt=function()
     {
          var pX, pY;
          pX = (this.sx >= 0) ? 0 : ns ? innerWidth :
          document.documentElement && document.documentElement.clientWidth ?
          document.documentElement.clientWidth : document.body.clientWidth;
          pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ?
          document.documentElement.scrollTop : document.body.scrollTop;
          if(this.sy<0)
          pY += ns ? innerHeight : document.documentElement && document.documentElement.clientHeight ?
          document.documentElement.clientHeight : document.body.clientHeight;
          this.cx += (pX + this.sx - this.cx)/8;this.cy += (pY + this.sy - this.cy)/8;
          this.sP(this.cx, this.cy);
          setTimeout(this.id + "_obj.flt()", 40);
     }
     return el;
}
JSFX_FloatDiv("divTopRight",        -100,   10).flt();

</script>
---------------------------------------------------------------------------------------------------------------------------------------

-tushar
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:pgilfeather
ID: 12277625
Im showing my clock in a textbox which is positioned by a table.
0
 
LVL 18

Expert Comment

by:tusharashah
ID: 12278233
Well then you need same thing for table also, just before table start <div> like following and after your </table> tag put a </div> tag!

----------------------------------------------------------------------
<div id="divTopRight"    style="position:absolute">
--> Your table
</div>
----------------------------------------------------------------------

-tushar
0
 

Author Comment

by:pgilfeather
ID: 12284900
id="divTopRight

Should this be the id of my textbox?

How does javascript know about my textbox?
0
 

Author Comment

by:pgilfeather
ID: 12285542
Thanks, your code worked excellently.

I've never used div tags before so I am well chuffed!

Cheers

Paul G
0
 
LVL 18

Expert Comment

by:tusharashah
ID: 12286089
Glad to know that :-)

Thanks for A!

-tushar
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question