?
Solved

OnClick Event does not inlcude scrollbar?

Posted on 2004-11-29
14
Medium Priority
?
384 Views
Last Modified: 2012-05-11
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>
0
Comment
Question by:jb6884
  • 5
  • 4
  • 3
  • +1
14 Comments
 
LVL 25

Expert Comment

by:archrajan
ID: 12697946
Try this

window.onscroll = doSomething;
0
 
LVL 25

Expert Comment

by:archrajan
ID: 12697962
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.
0
 

Author Comment

by:jb6884
ID: 12698019
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.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 25

Expert Comment

by:archrajan
ID: 12698319
guess u cannot do that...
0
 
LVL 5

Expert Comment

by:intreeg
ID: 12699253
" 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?
0
 

Author Comment

by:jb6884
ID: 12699328
'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.
0
 

Author Comment

by:jb6884
ID: 12699372
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.

0
 
LVL 5

Expert Comment

by:intreeg
ID: 12699405
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.
0
 

Author Comment

by:jb6884
ID: 12701023
Yes, I'm keeping all previous info and adding to it at the bottom.
0
 
LVL 5

Expert Comment

by:intreeg
ID: 12701077
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.
0
 

Accepted Solution

by:
elleonsenga earned 200 total points
ID: 12704109
Hi.

In your code, change "onclick" to "onfocus" like this one:

Code
====
<form name="form">
          <textarea rows="8" name="wstatus" cols="60" style="n" onFocus="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>
=====

It should work. I have tested it.
0
 

Author Comment

by:jb6884
ID: 12706488
that did it.  Thanks!
0
 
LVL 5

Expert Comment

by:intreeg
ID: 12706923
Nice Work!
0
 

Expert Comment

by:elleonsenga
ID: 12712547
thanks!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Strategic internal linking is often considered an SEO power technique, especially for content marketing. Do you need to hire an SEO agency to optimize you internal linking? No, this article will help you understand the basics of internal linking and…
How do you create a user-centered user experience on your website? And what are some things you should consider in the process?
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses
Course of the Month9 days, 1 hour left to enroll

621 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