Solved

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

Posted on 2004-10-11
4
203 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

733 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