|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
RollOver and onMouseOver?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';") -- Show quoteSincerely, S. Justin Gengo, MCP Web Developer / Programmer www.aboutfortunate.com "Out of chaos comes order." Nietzsche "Rob R. Ainscough" <roba***@pacbell.net> wrote in message news:eK9cVsGGGHA.1288@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. > 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. Show quote "S. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate.com> wrote in message news:uJFBgeIGGHA.2468@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" <roba***@pacbell.net> wrote in message > news:eK9cVsGGGHA.1288@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. >> > > 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. -- Show quoteSincerely, S. Justin Gengo, MCP Web Developer / Programmer www.aboutfortunate.com "Out of chaos comes order." Nietzsche "Rob R. Ainscough" <roba***@pacbell.net> wrote in message news:%23sfHBLJGGHA.2612@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:uJFBgeIGGHA.2468@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" <roba***@pacbell.net> wrote in message >> news:eK9cVsGGGHA.1288@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. >>> >> >> > > 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? -- Show quoteSincerely, S. Justin Gengo, MCP Web Developer / Programmer www.aboutfortunate.com "Out of chaos comes order." Nietzsche "Rob R. Ainscough" <roba***@pacbell.net> wrote in message news:%23sfHBLJGGHA.2612@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:uJFBgeIGGHA.2468@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" <roba***@pacbell.net> wrote in message >> news:eK9cVsGGGHA.1288@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. >>> >> >> > > |
|||||||||||||||||||||||