dcsimg
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: ASP.NET
Expertise: Intermediate
May 19, 2004

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Create Rollover Graphics in ASPX Pages

Although this tip creates onmouseover and onmouseout attributes in the IMG tag within the A tag when rendered to the browser, it could be used to set any attributes.

Create a Hyperlink control on the .aspx page (with an ID of 'lnkImage' in this example). In the codebehind, create a new image, set it's attributes and add it to the controls collection of the hyperlink (substitute you own images for icon.gif and icon_hot.gif):


Private Sub Page_Load ...
    Dim IMG as new WebControls.Image
    IMG.ImageUrl = "Images/icon.gif"
    IMG.Attributes.Add("onmouseover", "this.src='Images/image_hot.gif';")
    IMG.Attributes.Add("onmouseout", "this.src='Images/image.gif';")
    IMG.Controls.Add(IMG)
End Sub
David Derf
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date