?
Solved

JS Events

Posted on 2004-08-24
6
Medium Priority
?
293 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 19

Accepted Solution

by:
dakyd earned 2000 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…
Suggested Courses

752 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