ASP.NET and Javascript

  • Thread starter Thread starter Amy Snyder
  • Start date Start date
A

Amy Snyder

Is there a way for me to change the ImageUrl property for an image using
javascript? I am assuming there is since I am using javascript to show
and hide the panel that the image is on. If so, what would the correct
syntax be?
 
Hi Amy,

It depends on what kind of effect you're trying to achieve. The code below
shows using the onmouseover event. Perhaps you can show us what you need to
accomplish?

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Image1.Attributes.Add _
("onmouseover", _
"this.src='http://www.gc.ca/images/francaisbt.gif'")
End Sub


<form id="Form1" method="post" runat="server">
<asp:Image id="Image1" runat="server"
ImageUrl="http://www.gc.ca/images/englishbt.gif"></asp:Image>
</form>



Ken
MVP [ASP.NET]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top