By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,365 Members | 1,245 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,365 IT Pros & Developers. It's quick & easy.

RollOver and onMouseOver?

P: n/a
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.
Jan 13 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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
"Rob R. Ainscough" <ro*****@pacbell.net> wrote in message
news:eK**************@TK2MSFTNGP09.phx.gbl...
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.

Jan 13 '06 #2

P: n/a
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. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:uJ**************@TK2MSFTNGP10.phx.gbl...
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
"Rob R. Ainscough" <ro*****@pacbell.net> wrote in message
news:eK**************@TK2MSFTNGP09.phx.gbl...
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.


Jan 13 '06 #3

P: n/a
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 R. Ainscough" <ro*****@pacbell.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate.com> wrote
in message news:uJ**************@TK2MSFTNGP10.phx.gbl...
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
"Rob R. Ainscough" <ro*****@pacbell.net> wrote in message
news:eK**************@TK2MSFTNGP09.phx.gbl...
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.



Jan 14 '06 #4

P: n/a
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
"Rob R. Ainscough" <ro*****@pacbell.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate.com> wrote
in message news:uJ**************@TK2MSFTNGP10.phx.gbl...
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
"Rob R. Ainscough" <ro*****@pacbell.net> wrote in message
news:eK**************@TK2MSFTNGP09.phx.gbl...
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.



Jan 14 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.