<asp:HyperLink> pop up message

  • Thread starter Thread starter illmagination
  • Start date Start date
I

illmagination

Hi,

I need to display a small pop up message warning the user is leaving
the website. At the same time I need to also keep track of who is
leaving the website. My problem is that I can't user javascript in
asp:hyperlink tags. Should I just use a regular <a> tag and include the
IDs and Runat=Server tags?


Here is my code

<asp:HyperLink ID="lnkTradeUp" runat="server" Target="_blank"
NavigateUrl="http://www.google.com" onclick="javascript:ExitWebsite()"
CssClass="Small">Trade-Up FAQs</asp:HyperLink>
 
You can use javascript: prefix in the NavigateUrl property as in
NavigateUrl="javascript:alert ('Me');"

Or from the code-behind add lnkTradeUp.Attributes.Add ("onclick", "<JS code
goes here>");

Hi,

I need to display a small pop up message warning the user is leaving
the website. At the same time I need to also keep track of who is
leaving the website. My problem is that I can't user javascript in
asp:hyperlink tags. Should I just use a regular <a> tag and include the
IDs and Runat=Server tags?


Here is my code

<asp:HyperLink ID="lnkTradeUp" runat="server" Target="_blank"
NavigateUrl="http://www.google.com" onclick="javascript:ExitWebsite()"
CssClass="Small">Trade-Up FAQs</asp:HyperLink>
 
Back
Top