HREF links and javascript: Navigation

Posted by: Rick Strahls WebLog, on 02 Jan 2007 | View original | Bookmarked: 0 time(s)

I seem this mistake  repeatedly: I have a hyperlink on a page and rather than execute another URL I want it to execute a small bit of JavaScript code. Something like click a button and hide another control on the page:   <a href="javascript:document.getElementById('DragPanel').style.display='none';">Click</a>   This might seem reasonable, but if you run this code youll quickly find out that this doesnt work. Well, the control hides alright but so does everything else...

Advertisement
Category: JavaScript | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 2338 | Hits: 166

Similar Posts

  • WPF NavigationWindow, WinFormsHost and TextBoxes: backspace bug more
  • ASP.NET Performance Improvements in DevExpress 2009 volume 2 more
  • Using T4MVC strongly-typed helpers with Telerik Extensions for ASP.NET MVC more
  • NavigationWindow, WinFormsHost and TextBoxes: backspace bug more
  • SEO Tip - Beware of the Login pages - add them to Robots Exclusion more
  • Using the ClientAPI to retrieve safe JS strings for Localization in Gallery more
  • Compressing JS files as part of your build process more
  • How to build a cross-browser history management system more
  • December 16th Links: ASP.NET, ASP.NET AJAX, ASP.NET MVC, VS, .NET, IIS7, WPF more
  • Feb 17th Links: ASP.NET, ASP.NET AJAX, Visual Studio, .NET more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD