html

  • Cross Browser Support for DOM Events

    Firefox follows the DOM standard and passes an event object to each event listener, however has the global event: windows.event. Problem:I wanted to fire a piece of javascript after the user keyed some text and pressed enter or clicked a button. The skeleton code is below:<input id=”NewsletterEmail” value=”Email here” type=”text”   onfocus=”javascript:this.value = ”;” class=”WiderLoginTextBox” /><input value=”OK”…

    Know More

  • Strip HTML Tags from a String using Regular Expressions 

    Whilst writing some code to search forum posts I had the reason to remove all HTML tags from the forum posts before I could do a valid phrase search. I created the following function: public static string StripDecodeHtml(string content){  content = HttpUtility.HtmlDecode(content);  string myTagPattern = @”]*>(?<text>.*?)“;  Regex myTagRegex = new Regex(myTagPattern, RegexOptions.Compiled          |RegexOptions.IgnoreCase|RegexOptions.Singleline);  // do until no more tags…

    Know More