Solved

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

Posted on 2004-10-11
4
198 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

773 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