473,396 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How do I control scrolling created by CSS?

I have a <p> tag that I use to show the output of a program as it dumps it's output to the screen (ECHOs). My javascript has listeners for output, and dumps the output into this p tag. When it exceeds the screen size (defined by a <div> tag), then scrollbars appear. I need to have it always show the bottom of the window, like a terminal window would do. How can I do this automatically with javascript? Let me know what code you'd want to see for this (I'm using adobe AIR, so most of the program handling is done by AIR).
Dec 15 '10 #1
3 2144
acoder
16,027 Expert Mod 8TB
You could use scrollIntoView
Dec 16 '10 #2
I tried that one. It didn't work, nor did any of the other JS scrolling options. The box doesn't have a scroll until it overflows (done with CSS - overflow:scroll;

And My code here looks like this:
Expand|Select|Wrap|Line Numbers
  1.     <div class="consoleBox">
  2.         <p id="consoleOutput" class="consoleText"></p>
  3.     </div>
  4.     <br />
  5.     <div style="margin-left:auto;margin-right:auto;width:95%;">
  6.         <input type="text" id="consoleInput" style="width:75%" />
  7.         <input type="button" onclick="sendToConsole();" style="width:20%;margin-left:3px;" value="Send to console" />
  8.     </div>
  9.  
And when I add to it, I do by the following:
Expand|Select|Wrap|Line Numbers
  1. var consoleScreen = document.getElementById("consoleOutput");
  2.         var data = encodeProcess.standardOutput.readUTFBytes(encodeProcess.standardOutput.bytesAvailable);
  3.         consoleScreen.innerText += data;
  4.  
encodeProcess is a process thread handle object, that allows me to read and write to STDOUT and STDIN, respecively. Anyway, none of the scroll properties that I saw in Javascript proper let me scroll like I needed to, so now I'm trying jQuery. Does anybody have another idea? Basically, the output from this terminal will exceed 10 pages every time, and sometimes might be hundreds of pages.
Dec 16 '10 #3
Ah. Got it. So, I had to change the last line to be the following:

Expand|Select|Wrap|Line Numbers
  1. var consoleScreen = document.getElementById("consoleOutput");
  2.         var data = encodeProcess.standardOutput.readUTFBytes(encodeProcess.standardOutput.bytesAvailable);
  3.         consoleScreen.innerText += data;
  4.         $('#consoleBox').scrollTop(document.getElementById("consoleBox").scrollHeight);
  5.  
Turns out that I wasn't even grabbing the div tag...stupid me. Sorry for a silly mistake. This now makes what looks like a terminal window, focused on the bottom of the window.
Dec 16 '10 #4

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

Similar topics

0
by: Dave harris | last post by:
Is anyone aware of any issues with Drag and Drop in a treeview having trouble scrolling past the top/bottom? For this particular control, scrolling down works about 50% of the time and is pretty...
3
by: fumihiko | last post by:
Hi, I created an activex control (C++), and it uses another COM dll (C++). This COM dll links with a static library that dose some calculation. (both are debug multithreaded dll) I created a...
7
by: Sky | last post by:
What I have currently: I have a user control called mod_container.aspx that is basically two divs -- the top a toolbar, that expands/collapse the second div which can contain other...
5
by: Doug Handler | last post by:
Hi, I have a form (Form1) that contains a tab control which one tab has a customer user control (UserControl1). When the user double-clicks on the grid hosted there a new user control is...
4
by: magreenb | last post by:
I need the browser to scroll my asp.net page to the bottom when the user clicks on a server-side link or button at the top of the page. I added an anchor tag <a name=#bottom> to the html and tried...
3
by: iwdu15 | last post by:
hi, is there any way to scroll the web browser to the bottom of the document? thanks -- -iwdu15
1
by: atif | last post by:
Hi, I m new to CSharp.. so may be my preliminary questions look stupid.. but plz help me.. I want to drag controls like buttons or some other user controls over form.. i have set form's...
0
by: August97 | last post by:
Hi All, I am porting VB5 code to VB6. In this, I have to port OCX control created in VB5 to VB6. I just opened corresponding VBP file in VB6 IDE and used File -> Make ocx. It didn't give any...
7
by: Lou | last post by:
I have a menu item that creates a new command button. Each time I create a new command button I need to position it to the left of the last created button. In VB6 I could create a control array,...
2
by: Steve | last post by:
I have a continuous form showing Product Code and Product Name. Product Code is five digits and is sequential. I have a textbox in the form header. What is the code to scroll the continuous form so...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.