Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fire element mouseover from another element

Status
Not open for further replies.

KDavie

Programmer
Feb 10, 2004
441
US
Hello,

I have a div which contains an input button and an image. The image is centered over the button inside of the div.

Code:
<div>
   <input id="btnHistory" type="button" value="" onclick="DoSomething(this);"  />
   <img id="imgArrowDown" src="Images/DropDownArrow.gif" style="margin-left:-7px;margin-top:-9px;" onclick="FireButtonClick(this)" onmouseover="FireMouseOver(this);" onmouseout="FireMouseOut(this);" />
</div>

I am trying to bubble the image mouseover to the button so when the image is moused over, the button's inner highlight turns orange (default mouseover behavior). I can't seem to cause the default mouseover to fire... I can add my own code, but I don't think there is a way I can force the inner highlight to appear.

Any help would be appreciated.

Thanks,

-Kevin

 
Why not place the image within the input field and apply the event triggers to to the input field itself?

Try this:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
  .imgbtn {
  padding-left: 20px;
  width: 95px;
  background:url("Images/DropDownArrow.gif") no-repeat;
  background-color: #CCC;
  border: 1px solid #CCC;
}
 .imgbtn:hover {
  cursor: pointer;
  border: 1px solid orange;
}
</style>

</head>

<body>
<input class="imgbtn" type="button" value="" onclick="DoSomething(this);" />
</body>
</html>

This should basically place an image within the input field. You can use this with any input field.

Why is the value of the input field blank?

I get a nice effect in FF not in IE 6.0 ... Not sure about IE 7.0

Hope this helps!




--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top