Link to home
Start Free TrialLog in
Avatar of jb6884
jb6884

asked on

OnClick Event does not inlcude scrollbar?

How can I get the onClick event of the following to include the scrollbar as well?  It works just fine if I click in the textarea, but if I only click on the scrollbar it doesn't pick it up as the click event.

<form name="form">           
          <textarea rows="8" name="wstatus" cols="60"  onclick="window.document.form.wdone.checked='true'"></textarea>
          <input type="Checkbox" name="wdone"><Font size="-1">Hold</font>
          <br>
          <span id="timerlabel"></span>
          <span id="timer"></span>
          </td>
</form>
Avatar of archrajan
archrajan

Try this

window.onscroll = doSomething;
document.onscroll = dosomething // for firefox

In MSIE the event handler is:

window.onscroll = dosomething;

window.onscroll is also working in Mozilla, but document.onscroll isn't
in MSIE.
Avatar of jb6884

ASKER

I can't do that because I have a document.form.wstatus.doScroll("down") running on a timer.  I'm feeding the textarea lines of text from a VBScript, and in order to keep the last line in view, I had to constantly scroll the window.  Now what I'm trying to do is enable the user to click on the textarea OR scrollbar which checks the wdone field, which in turn stops the auto scrolling.  It all works, except the dang scrollbar is not included in the onClick event of the textarea.
guess u cannot do that...
" I'm feeding the textarea lines of text from a VBScript, and in order to keep the last line in view, I had to constantly scroll the window."
You need to figure out a different way to do this and use the onScroll function as suggested by archrajan. Could you replace all of the text with the text and the new line?
Avatar of jb6884

ASKER

'Could you replace all of the text with the text and the new line?

that is essentially what I'm doing, but the window will stay scrolled to the top.  This needs to readout like a status window for the script, and the doscroll thingy (see my above comment) was the only way I could accomplish having the newest line visible.  I did toy with the idea of reversing the order of the lines of text, so that the newest line would be at the top and thus not needing the doscroll, however that just didn't look right.
Avatar of jb6884

ASKER

Does anyone know how I could scroll the textarea box from a VBScript?  If so I could scroll the box one line at a time, and get rid of my doscroll, and the need for any checkbox/onclick to stop the doscroll.

What if you remove the top or first line of text when you add the new or bottom line of text would this not prevent the need to scroll? I am not sure I am understanding the why you would need to scroll? Are you trying to keep all of the previous info and add more info to the bottom? If that is the case you are right other than reversing the order you would have to scroll to the bottom to see the new text. Otherwise if you are "replacing" instead of adding to it you should be able to keep the number of lines consistent and therefore would no longer need to scroll.
Avatar of jb6884

ASKER

Yes, I'm keeping all previous info and adding to it at the bottom.
If that is the case then I am not sure there is a solution. You would have to either only display X number of lines or reverse the order and display new info on top. Either of these would allow you to do away with the autoscroll and then be able to use the onScroll event.

Otherwise, I doubt it would make a difference but you could try using onMouseDown or onMouseOver possible for your "window.document.form.wdone.checked='true'" statement.
ASKER CERTIFIED SOLUTION
Avatar of elleonsenga
elleonsenga

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jb6884

ASKER

that did it.  Thanks!
Nice Work!
thanks!