简体   繁体   中英

Changing LinkButton Content on hover

i'm trying to change the a linkbutton content so when the mouse is over it, it will change it's content to "Sign Out".

the content before is:

   <asp:LinkButton  ID="Logged" runat="server" class="Connected"  OnClick="Logged_Click">Hello <asp:Label ID="name" runat="server" Text="name"></asp:Label></asp:LinkButton>

after: suppose to be:

   <asp:LinkButton  ID="Logged" runat="server" class="Connected"  OnClick="Logged_Click">Log Out </asp:LinkButton>

i've uploaded my code to fiddle and it seems to be working but it doesn't show the label in the link button when not hovering. also, it works on fiddle but not on my computer.

the way the Login/basket and Register/Hello(#Logged) works is that the user logs into the website and then the linkbuttons "login" and "register" dissapear and it shows the linkbuttons "basket" and " hello + Label(contains User's FirstName)"

on my computer,it doesn't change hello(#Logged) LinkButton to "Sign Out" .

what can i do to fix it?

I don;t know much about asp - but you can achieve this with CSS only

 #button:before{ content:'Hello'} #button:hover:before{ content:'Sign Out'} 
 <button id="button" type="button"></button> 

 <style> a.content::after{content:'Hello'} a.content:hover::after{content:'Sign Out'} </style> <a class="content"></a> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM