Home > ASP.Net, Javascript > Highlight image and text OnMouseOver

Highlight image and text OnMouseOver


try this example:

<div style="width:400;height:500;" onmouseover="hightlight()" onmouseout="removehightlight()">
<span id="textspan" >This is a test div to show mouseover</span><img id="imgsrc" src="/images/test.gif" /></div> 

here is the javascript stuff

 <script language="javascript">
function hightlight()
    document.getElementById("textspan").style.color = "blue";
    document.getElementById("imgsrc").style.border = "1px solid blue";

function removehightlight()
    document.getElementById("textspan").style.color = "black";
    document.getElementById("imgsrc").style.border = "0px solid blue";

Hope this helps

Good Luck 😀

Categories: ASP.Net, Javascript
  1. sergeos
    February 7, 2009 at 1:20 pm

    nice example, but if images present in datalist then only first img get styling.

    <img id=”imgsrc” alt=”” border=”none” height=”80″ src=”
    width=”80″ />

  2. sergeos
    February 7, 2009 at 1:21 pm
                                    <a href='Batteries.aspx' rel="nofollow"> &lt;%--?productID='&gt;--%&gt;
                                        &lt;img id="imgsrc" alt="" border="none" height="80" src=''
                                            width="80" /&gt;
  3. yasserzaid
    February 7, 2009 at 2:37 pm

    Hi sergeos

    Could you please send me your code

    Good Luck

  4. sergeos
    February 7, 2009 at 3:01 pm

    I don’t know your email, so upload to http://www.eprice.by/dl_img.txt

  5. yasserzaid
    February 7, 2009 at 3:52 pm


    Try this example i posted for you


    Hope this helps you

    Good Luck

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: