Click here to Skip to main content
15,893,564 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi...

how to write the code for onmouse event code
ex: in this website if put the mouse in home it will display all the content in it this is my requirement so how to write the code

regards
mahesh
Posted
Updated 2-Sep-12 16:26pm
v2

hi Mahesh,

To show tool tip on mouse over you can use title attribute of any input tag.

example :
http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_standard_title[^]
 
Share this answer
 
Download this file...........
http://www.menucool.com/tooltip/src/prod/Tooltip.zip[^]

Download the source code (CSS file and JavaScript)


Put the extracted files into your site, and add the following two links into the <head> section of the page where you want to use the tooltip.

XML
<link type="text/css" rel="stylesheet" href="Tooltip.css" />
<script type="text/javascript" src="Tooltip.js"></script>



Find the element that triggers the tooltip, and set the client event for the tooltip:

Example:-
<asp:button id="btn1" runat="server" text="ToolTipDemo" cssclass="tooltip" onmouseover="tooltip.pop(this,'Hi there')" xmlns:asp="#unknown">
 
Share this answer
 
XML
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<script language="Javascript">
<!--
function toggleDiv(id,flagit,s) {
if (flagit=="1"){
if (document.layers) document.layers[''+id+''].visibility = "show"
else if (document.all) document.all[''+id+''].style.visibility = "visible"
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "visible"
var objFrame=document.getElementById("myframe");
objFrame.src = s;
}
else
if (flagit=="0"){
if (document.layers) document.layers[''+id+''].visibility = "hide"
else if (document.all) document.all[''+id+''].style.visibility = "hidden"
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden"
}
}
//-->


</script>
<style type="text/css">#div1, #div2, #div3 {position:absolute; top: 50; left: 20; width:400; visibility:hidden}</style>


</head>
<body>
    <form id="form1" runat="server">
    <div>
    <a href="#" onMouseOver="toggleDiv('div1',1,'Default2.aspx')" onMouseOut="toggleDiv('div1',0,'Default2.aspx')">Link 1!</a> |
<a href="#" onMouseOver="toggleDiv('div1',1,'Default3.aspx')" onMouseOut="toggleDiv('div1',0,'Default3.aspx')">Link 2</a> |
<a href="#" onMouseOver="toggleDiv('div1',1,'http://www.google.com')" onMouseOut="toggleDiv('div1',0,'http://www.google.com')">Link 3</a>
<div id="div1"><iframe id="myframe" NAME="myframe" src="about:blank" width="400px" height="400px"></iframe></div>

    </div>
    </form>
</body>
</html>



This is the code. I hope it will help you.
 
Share this answer
 
Comments
mahesh202 9-Sep-12 21:53pm    
thanx ....
and actual requirement not only one label am using 4 labels so how to write this one
am written this code but not get output
function changecolor()
if(x==1){
var v= document.getElementById("<Button1.ClientId%>);
v.style.backcolor="red";
}
if(x==2){var b=document.GetElementById("<=Button1.clientId%>");
b.style.Backgroundcolor="#cococo";
}
}

bu this is work only one button i want all the buttons

thanxs in advance...



























}
anjani123 10-Sep-12 0:44am    
onMouseOver="toggleDiv('div1',1,'Default3.aspx')" onMouseOut="toggleDiv('div1',0,'Default3.aspx'

you need to add this on all buttons....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900