Solved

JS Events

Posted on 2004-08-24
6
291 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
Industry Leaders: 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!

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

739 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