Solved

Enable scrollbar at table cell, HTML, Javascript

Posted on 2007-04-11
4
883 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
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)

911 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

19 Experts available now in Live!

Get 1:1 Help Now