1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Strip HTML Tags script

Discussion in 'JavaScript' started by t7584, Dec 15, 2006.

  1. #1
    t7584, Dec 15, 2006 IP
  2. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #2
    I've not tested but this function should work:

    
    function stripHTML2()
    {
      var re1= /<\S[^><]*>/g;
      var re2= /http:\/\//gi;
      for (i=0; i<arguments.length; i++)
      {
        var aux = arguments[i].value.replace(re1, "");
        arguments[i].value = aux.replace(re2, "")
      }  
    }
    
    Code (markup):
    Note: Using "gi" on regular expression 2 to transform "http://" on lowercase, uppercase and mixcase.
     
    ajsa52, Dec 16, 2006 IP