RollOver and onMouseOver?

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.
 
S

S. Justin Gengo [MCP]

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
 
R

Rob R. Ainscough

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.
 
S

S. Justin Gengo [MCP]

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
 
S

S. Justin Gengo [MCP]

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
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top