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).
How do I control scrolling created by CSS?
Collapse
X
-
-
-
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:
Code:<div class="consoleBox"> <p id="consoleOutput" class="consoleText"></p> </div> <br /> <div style="margin-left:auto;margin-right:auto;width:95%;"> <input type="text" id="consoleInput" style="width:75%" /> <input type="button" onclick="sendToConsole();" style="width:20%;margin-left:3px;" value="Send to console" /> </div>
Code:var consoleScreen = document.getElementById("consoleOutput"); var data = encodeProcess.standardOutput.readUTFBytes(encodeProcess.standardOutput.bytesAvailable); consoleScreen.innerText += data;
Comment
-
Ah. Got it. So, I had to change the last line to be the following:
Code:var consoleScreen = document.getElementById("consoleOutput"); var data = encodeProcess.standardOutput.readUTFBytes(encodeProcess.standardOutput.bytesAvailable); consoleScreen.innerText += data; $('#consoleBox').scrollTop(document.getElementById("consoleBox").scrollHeight);
Comment
Comment