Solved

JS Events

Posted on 2004-08-24
6
286 Views
Last Modified: 2010-05-18
Hello all!

I know there are alot of events in Javascript, such as onClick, onMouseOver, onMouseOut, etc etc etc.

Is there one that control when you release your mouse from an onClick?  like onRelease or something?

basically, I have a scrollbar styled with css (yes, i know this only works in IE), and I want the scrollbar color to change onClick and onRelease (or whatever the event really is).

Any thoughts?  Thanks in advance.
0
Comment
Question by:flow79
  • 3
  • 3
6 Comments
 
LVL 19

Expert Comment

by:dakyd
ID: 11882078
I think the one you're looking for is onMouseUp (there's also it's opposite, on MouseDown)
0
 
LVL 13

Author Comment

by:flow79
ID: 11882091
very cool - let me check it out, and get back to you in a few minutes.
0
 
LVL 13

Author Comment

by:flow79
ID: 11882142
that seems to work (kinda).  do you mind looking at this page for me?  currently, the onMouseDown and onMouseUp work, but only when in the div (not over the scrollbar).  It seems that onMouseDown DOES work on the scrollbar, but onMouseUp doesnt.  Any ideas?

Thanks


<html>
<head>
<title>Untitled</title>
<style type="text/css">
<!--
.scrolly {
      width: 300px;
      height: 100px;
      overflow: auto;
      scrollbar-base-color: #003366;
      scrollbar-arrow-color: #ffffff;
      border: #003366 1px solid;
      padding: 3px;
      font-size: 8pt;
      font-family: verdana;
      color: #003366;
      }
-->
</style>
<script language="JavaScript" type="text/javascript">
<!--
function scrolly(element){
document.all(element).style.scrollbarBaseColor = "#3399cc"
}
function unscrolly(element){
document.all(element).style.scrollbarBaseColor = "#003366"
}
//-->
</script>
</head>
<body>
<div class="scrolly" id="scroller" onMouseDown="scrolly('scroller')" onMouseUp="unscrolly('scroller');">
      <p>
             Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed et pede.
             Suspendisse quis risus et elit congue adipiscing. Aliquam erat volutpat.
             Mauris consequat. Maecenas ligula orci, luctus vitae, euismod vel,
             malesuada a, orci. Nullam vel mi vitae tortor nonummy porttitor.
             Maecenas sit amet sem vitae lacus sodales vulputate. Etiam et tellus.
             Nam et felis. Maecenas rhoncus molestie nisl. Phasellus placerat luctus
             ipsum.
      </p>
</div>
</body>
</html>
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 19

Accepted Solution

by:
dakyd earned 500 total points
ID: 11882860
Give this a shot - I left in the document.all since you're okay with IE-only.  Instead of onmouseup/onmousedown, I used onscroll and a timeout to change it back when you're done scrolling.  Hope that helps.

<html>
<head>
<title>Untitled</title>
<style type="text/css">
<!--
.scrolly {
     width: 300px;
     height: 100px;
     overflow: auto;
     scrollbar-base-color: #003366;
     scrollbar-arrow-color: #ffffff;
     border: #003366 1px solid;
     padding: 3px;
     font-size: 8pt;
     font-family: verdana;
     color: #003366;
     }
-->
</style>
<script language="JavaScript" type="text/javascript">
<!--
var timer;
function scrolly(element){
  clearTimeout(timer);
  document.all(element).style.scrollbarBaseColor = "#3399cc";
  timer = setTimeout("unscrolly('scroller')", 250);
}
function unscrolly(element){
  document.all(element).style.scrollbarBaseColor = "#003366"
}
//-->
</script>
</head>
<body>
<div class="scrolly" id="scroller" onscroll="scrolly(this.id)">
           Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed et pede.
           Suspendisse quis risus et elit congue adipiscing. Aliquam erat volutpat.
           Mauris consequat. Maecenas ligula orci, luctus vitae, euismod vel,
           malesuada a, orci. Nullam vel mi vitae tortor nonummy porttitor.
           Maecenas sit amet sem vitae lacus sodales vulputate. Etiam et tellus.
           Nam et felis. Maecenas rhoncus molestie nisl. Phasellus placerat luctus
           ipsum.
</div>
</body>
</html>
0
 
LVL 13

Author Comment

by:flow79
ID: 11883318
thats a pretty cool solution - i like it.  Thanks!
0
 
LVL 19

Expert Comment

by:dakyd
ID: 11883384
Well, so long as you like it.  =p  Glad you got what you wanted.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now