Solved

Enable scrollbar at table cell, HTML, Javascript

Posted on 2007-04-11
4
885 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
ID: 18889919
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
ID: 18891521
sankarbha's code is a good one...
0
 

Author Comment

by:ioustinos_sarris
ID: 18899896
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
ID: 18903684
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
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…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

821 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