RollOver and onMouseOver?

  • Thread starter Thread starter Rob R. Ainscough
  • Start date Start date
R

Rob R. Ainscough

I'm using .NET v1.1 with ASPX web page.

I'm trying to have a RollOver hyperlink that will change images on an image
control and update the text in a Label control. I've got the image swapping
working, however I don't know how to get my Label control text to change
with the onMouseOver event

HTML...

</asp:hyperlink><asp:hyperlink id="lnkImageS" style="Z-INDEX: 113; LEFT:
92px; POSITION: absolute; TOP: 94px" runat="server"
Width="59px" Height="103px">
<asp:Image runat="server" Width="59px" ID="Image1" Height="103px"
ImageUrl="Graphics/SizeDiagrams_03.jpg"
style="Z-INDEX: 113; LEFT: 6px; POSITION: absolute; TOP:
92px"></asp:Image>

Page_Load...

im_XS.ImageUrl = "Graphics/SizeDiagrams_03.jpg"
im_XS.Attributes.Add("name", im_XS.ClientID)
lnkImageXS.NavigateUrl = "#"
lnkImageXS.Attributes.Add("onMouseOver", im_XS.ClientID &
".src='Graphics/SizeDiagramsRoll_03.jpg'; window.status='Mouse Over Image';
return true;")
lnkImageXS.Attributes.Add("onMouseOut", im_XS.ClientID &
".src='Graphics/SizeDiagrams_03.jpg'; window.status=' '; return true;")

What I would like in an onMouseOver that will let me change the image AND
change the text of a Label control -- any suggestions?

Rob.
 
Rob,

lnkImageXS.Attributes.Add("onMouseOver", im_XS.ClientID &
".src='Graphics/SizeDiagramsRoll_03.jpg'; window.status='Mouse Over Image';
return true;document.getElementById('" & MyLabel.ClientId & "').innerHtml =
'Mouse Over Text';")


--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
Justin,

This didn't work? my ASP.NET Label1 (in your sample this is MyLabel)
control still shows "Label" when I mouse over the lnkImageXS -- you could
should make the Label1 display "Mouse Over Text" right?

Rob.
 
Rob,

Yes, but I didn't test this code. Instead of innerHTML you may want to try
some of the other possibilties like innerText and innerContent.

But one of these methods is the way to do it. If I get a bit of time in a
little while this morning (my six year old wants to play) I'll test this and
figure out which one will work for certain.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
Rob,

I just noticed something. Since I just copied and pasted your code and
tacked on the document.getElement... at the end I didn't see your "return
true". You'll of course have to move the return true to the end of the
javascripts that are fired. Did you do that?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
Back
Top