I've seen lots of posts on here about creating an image rollover, but I can see that if it can't preload the image, this would be better achieved in Javascript, however my problem is, I want an asp:label to change its text when someone rolls over an image,
is this possible and if so, how? Remember, i know a' nothing. Thanks a million.
sure, it's simple onmouseover="document.getElementById("labelIDHere").innerHTML='whatever'" just a quick illustration, of course - you may want to be a bit neater and defensive against older browsers.
RTFM - straight talk for web developers. Unmoderated, uncensored, occasionally unreadable
Thats class and works for straight text strings i.e Hello, but I need to put a variable in there i.e Link1, its in the body of my page and it keeps telling me that I can't put tags in a method body or my server tags aren't well formed, I just don't understand
the syntax. Any advice would be appreciated.
That sounds like its doing the business, but I am a layman remember, I have no idea how to implement that. Is that in VB.net? Where does it go in the script? A short summary would be much appreciated otherwise I'm in the dark. Thanks in adavance. (P.s) the
link is called link1 and the label is called label1
Protected WithEvents label1 As Label
Protected WithEvents link1 As HyperLink
Protected Overrides Sub OnPreRender(ByVal e As EventArgs)
Dim serverSideVariable As String = "Test"
label1.Attributes.Add("onmouseover", "document.getElementById('" + label1.ClientID + "').innerHtml = '" + serverSideVariable + "';")
End Sub
By now I'm sure I am trying your patience, but please, I need this spelt out. I've put what you have typed into my page and nothing is happening. Have I even put it in right... I don't even know what language that is...
<script language="vbscript" runat="server">
Protected WithEvents label1 As Label
Protected WithEvents link1 As HyperLink
Protected Overrides Sub OnPreRender(ByVal e As EventArgs)
Dim serverSideVariable As String = "Test"
label1.Attributes.Add("onmouseover", "document.getElementById('" + label1.ClientID + "').innerHtml = '" + serverSideVariable + "';")
End Sub
</script>
PLEASE, you have been a big help
in understanding this thing, but as for putting it into practice, I'm a complete amateur, you'll have to spell it out for me. Thanks in advance.
<script language="vbscript" runat="server">
'Protected WithEvents label1 As Label
'Protected WithEvents link1 As HyperLink
Protected Overrides Sub OnPreRender(ByVal e As EventArgs)
Dim serverSideVariable As String = "Test"
link1.Attributes.Add("onmouseover", "document.getElementById('" + label1.ClientID + "').innerHTML = '" + serverSideVariable + "';")
End Sub
</script>
Click Me
Legend, thanks a lot. Out of interest, if you feel like replying, is that a hard thing to do? I mean what level is that on a scale of one to ten, just so I can get an understanding of this coding malarchy.
albinomagpie
Member
105 Points
23 Posts
Similiar but not a Rollover - Help
Apr 07, 2004 12:18 AM|LINK
Atrax
All-Star
18705 Points
3733 Posts
Re: Similiar but not a Rollover - Help
Apr 07, 2004 04:33 AM|LINK
Jason Brown - MVP, IIS
albinomagpie
Member
105 Points
23 Posts
Re: Similiar but not a Rollover - Help
Apr 08, 2004 09:08 PM|LINK
stiletto
All-Star
16995 Points
3304 Posts
Re: Similiar but not a Rollover - Help
Apr 09, 2004 03:35 AM|LINK
albinomagpie
Member
105 Points
23 Posts
Re: Similiar but not a Rollover - Help
Apr 14, 2004 04:37 PM|LINK
stiletto
All-Star
16995 Points
3304 Posts
Re: Similiar but not a Rollover - Help
Apr 15, 2004 01:27 AM|LINK
Protected WithEvents label1 As Label Protected WithEvents link1 As HyperLink Protected Overrides Sub OnPreRender(ByVal e As EventArgs) Dim serverSideVariable As String = "Test" label1.Attributes.Add("onmouseover", "document.getElementById('" + label1.ClientID + "').innerHtml = '" + serverSideVariable + "';") End Subalbinomagpie
Member
105 Points
23 Posts
Re: Similiar but not a Rollover - Help
Apr 15, 2004 04:21 PM|LINK
<script language="vbscript" runat="server"> Protected WithEvents label1 As Label Protected WithEvents link1 As HyperLink Protected Overrides Sub OnPreRender(ByVal e As EventArgs) Dim serverSideVariable As String = "Test" label1.Attributes.Add("onmouseover", "document.getElementById('" + label1.ClientID + "').innerHtml = '" + serverSideVariable + "';") End Sub </script>PLEASE, you have been a big help in understanding this thing, but as for putting it into practice, I'm a complete amateur, you'll have to spell it out for me. Thanks in advance.stiletto
All-Star
16995 Points
3304 Posts
Re: Similiar but not a Rollover - Help
Apr 16, 2004 02:03 AM|LINK
<script language="vbscript" runat="server"> 'Protected WithEvents label1 As Label 'Protected WithEvents link1 As HyperLink Protected Overrides Sub OnPreRender(ByVal e As EventArgs) Dim serverSideVariable As String = "Test" link1.Attributes.Add("onmouseover", "document.getElementById('" + label1.ClientID + "').innerHTML = '" + serverSideVariable + "';") End Sub </script> Click Mealbinomagpie
Member
105 Points
23 Posts
Re: Similiar but not a Rollover - Help
Apr 16, 2004 02:39 PM|LINK