Solved

How do you hold a textbox still while the webpage is scrolled?

Posted on 2004-10-11
4
187 Views
Last Modified: 2010-04-07
say I have a textbox...

id=txtTest

How can I get this to remain visible at all times when the page is being scrolled. I have posted this question several times and no one seems to provide any answer. Thus your help will be greatly appreciated.

Kind Regards

Paul G
0
Comment
Question by:pgilfeather
4 Comments
 

Author Comment

by:pgilfeather
ID: 12276555
Sorry, I forgot to say

Im using VB.NET
0
 
LVL 5

Expert Comment

by:stumpy1
ID: 12277009
If i am understanding your question correctly you want the textbox to float on the screen while you scrool the page.

The only way I can imagine doing it is using Clientside Javascript to dynamically change its position in the browser.
0
 
LVL 28

Expert Comment

by:mmarinov
ID: 12277055
Hi pgilfeather,

look at this article : http://www.mompswebdesign.com/dhtml/always_on_top_menu.html
it is about menu, but you can easy translate it for textbox

Regards!
B..M
0
 
LVL 18

Accepted Solution

by:
tusharashah earned 500 total points
ID: 12277057
Check out this code:

<html>

<script type="text/javascript">
var gTimer2 = null;
var gTimer2Count = 0;

function Timer2()
{
  gTimer2Count++;
  document.getElementById('txtBox').value = "Timer2 Running - " + gTimer2Count;
}
gTimer2 = window.setInterval("Timer2()",1000);

</script>

<body >



<div id="divTopRight"    style="position:absolute">
<input id='txtBox' type='TextBox' size="20" OnLoad = 'JSTimer();'/>

</div>
<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>
</body>

</html>
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Add json string to a javascript object 9 47
How do I get the id from URL? 19 47
Trouble with References... 5 22
Asp.net mvc 5 5 19
Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now