Solved

Enable scrollbar at table cell, HTML, Javascript

Posted on 2007-04-11
4
879 Views
Last Modified: 2008-02-01
Hi there,
I am creating an html page. I have a table, and in one of them i have enabled the scrollbar using
<div style="width:600px;height:400px;overflow:auto;">
However i would like to show the scrollbar and enable it only when the mouse is over that cell.
Anyone know how to do that in javascript?
0
Comment
Question by:ioustinos_sarris
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
sankarbha earned 50 total points
Comment Utility
try this:

<script language='javascript'>

function mouseover_divOne()
{
      document.getElementById('divOne').style.overflow='scroll';
}
function mouseout_divOne()
{
      document.getElementById('divOne').style.overflow='auto';
}

</script>

<div
id='divOne'
style="width:600px;height:400px;overflow:auto;"
onmouseover='mouseover_divOne();'
onmouseout='mouseout_divOne();'
>cell</div>
0
 
LVL 8

Expert Comment

by:jawahar_prasad
Comment Utility
sankarbha's code is a good one...
0
 

Author Comment

by:ioustinos_sarris
Comment Utility
seems very good...however
a. why when the scrolling of the list ends the normal page start scrolling?thats not really nice
b. how can i hide the horizontal scroll bar?
0
 
LVL 8

Expert Comment

by:sankarbha
Comment Utility
I dont get point (a)
Point (b) To hide horizontal scroll bar
<script language='javascript'>

function mouseover_divOne()
{
      document.getElementById('divOne').style.overflowY='scroll';
}
function mouseout_divOne()
{
      document.getElementById('divOne').style.overflowY='auto';
}

</script>

<div
id='divOne'
style="width:600px;height:400px;overflow-y:auto;"
onmouseover='mouseover_divOne();'
onmouseout='mouseout_divOne();'
>cell</div>

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

763 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

16 Experts available now in Live!

Get 1:1 Help Now