Solved

hyperlink mousemove

Posted on 2004-09-08
3
370 Views
Last Modified: 2012-05-05
how i can change the imageurl property from an hyperlink when the mouse pointer is over it?
0
Comment
Question by:Elvio Lujan
  • 2
3 Comments
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12009843
Add the following within the <HEAD></HEAD> section of the HTML of your aspx page.  

<script language=javascript>
function changeImage(imgCtl, newImgPath)
{
                // this'll work in IE, but probably not well cross browser.
     var ctl = document.getElementById(imgCtl);
     ctl.src = newImgPath;
}
</script>

Then in Page_Load if Page.PostBack == false, add the following: (Image1 is the image control).

this.Image1.Attributes.Add("onmouseover", "javascript:changeImage('" + this.Image1.ID + "', 'Images/Sunset.jpg');");
0
 
LVL 2

Expert Comment

by:sesurb
ID: 12009864
Hmm, hyperlink... seems like you would be better off using an imagebutton instead. Here is the code to use if you want to use an imagebutton.

Private Sub Page Load(blah, blah)
   ImageButton1.Attributes.Add("OnMouseOver", "this.src='/Common/images/btn_Cancel.gif'")
   ImageButton1.Attributes.Add("OnMouseOut", "this.src='/Common/images/btn_Submit.gif'")
End Sub
0
 
LVL 2

Accepted Solution

by:
sesurb earned 500 total points
ID: 12009877
if you use the image button then just add a redirect to the event of the button

Private Sub ImageButton1_Click(blah, blah)
     Response.Redirect("http://www.newpage.com")
End Sub
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

789 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