Solved

show/hide Div  on mouseover

Posted on 2010-09-01
8
770 Views
Last Modified: 2013-11-19
I have an image in web page inside a td. On mouse hover I want to show a div, right below the image, and I want the div to look like a drop down from the td.

Please help. any suggestions , urls will be helpful.


<td runat="server" id="tdShoppingCart" width="20%"  

style="background-color: #E5E5E5; height: 4px;" class="search">

<img src="Assets/Images/Master/shoppingcart.jpg"                 style="height: 34px; width: 60px; "   onmouseover="ShowCart('divCart')" onmouseout="HideCart('divCart');" />

 <div    id="divCart"    style="display:none;       position:absolute;       border-style: solid; background-color: #E5E5E5; height: 4px;      padding: 5px;" class="search">

 ctent here</div>

 </td>

Open in new window

0
Comment
Question by:TrialUser
8 Comments
 
LVL 14

Accepted Solution

by:
Daniel Junges earned 400 total points
ID: 33576041

<html>

<head>

<script language="javascript"> 



function ShowCart(id) {

	var ele = document.getElementById(id);

	ele.style.display = "block";

}



function HideCart(id) {

	var ele = document.getElementById(id);

  ele.style.display = "none";            

}

 

</script>

</head>



<body>

<table>

<tr>

<td runat="server" id="tdShoppingCart" width="20%"  

style="background-color: #E5E5E5; height: 4px;" class="search">

<img src="myImage.jpg"                 style="height: 34px; width: 60px; "   onmouseover="ShowCart('divCart')" onmouseout="HideCart('divCart');" />

 <div    id="divCart"    style="display:none;       position:absolute;       border-style: solid; background-color: #E5E5E5; height: 4px;      padding: 5px;" class="search">

 ctent here</div>

 </td>

 </tr>

 </table>

 </body>

 </html>

Open in new window

0
 
LVL 38

Assisted Solution

by:Tom Beck
Tom Beck earned 100 total points
ID: 33576051
Give the divCart a location top:XXpx; left:XXpx; and visibility:hidden and apply the javascript.
<script language="javascript" type="text/javascript">
function ShowCart(divId) {
    document.getElementById(divId).style.display = 'block';
    document.getElementById(divId).style.visibility = 'visible';
}
function HideCart(divId) {
    document.getElementById(divId).style.display = 'none';
    document.getElementById(divId).style.visibility = 'hidden';
}
</script>

Open in new window

0
 
LVL 18

Expert Comment

by:Eternal_Student
ID: 33576068
Why dont you use a javascript library such as Scriptaculous. There are many animations and effects you can use for this kind of thing, for example:

http://speckyboy.com/2008/04/26/20-top-scriptaculous-scripts-you-cant-live-without/
0
 

Author Comment

by:TrialUser
ID: 33576074
Thanks for your response. My problem is how can i make sure the div is placed right below my td. It should appear like it is an extension of the td, as though it is a drop down from the td. Thanks. Please help
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 18

Expert Comment

by:Eternal_Student
ID: 33576075
This looks like it is pretty similar to what you need:

http://www.exit404.com/lab/unobtrusive-persistent-scriptaculous/
0
 
LVL 18

Expert Comment

by:Eternal_Student
ID: 33576106
The blind down effect is simply:

Effect.BlindDown
0
 
LVL 22

Expert Comment

by:kadaba
ID: 33579316
using a library is always advantageous....
by the way in the previous post you could just very the position of the div and get it right down the td.
0
 

Author Closing Comment

by:TrialUser
ID: 33595835
thanks t on for your response
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
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.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
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)

746 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

15 Experts available now in Live!

Get 1:1 Help Now