Problem with strip html code, any help??

Results 1 to 2 of 2

Thread: Problem with strip html code, any help??

  1. #1
    Join Date
    Dec 1969

    Default Problem with strip html code, any help??

    I have been trying to use the strip html function in this link. I read the post from helpme below.<BR>But Im getting an error<BR><BR><BR><BR>This is my code, Im using javascript for all my functions<BR><BR>function stripHTML(strHTML)<BR>{<BR><BR> Set objRegExp = New Regexp;<BR><BR> objRegExp.IgnoreCase = True;<BR> objRegExp.Global = True;<BR> objRegExp.Pattern = "&#060;(.&#124
    )+?&#062;";<BR><BR> strOutput = objRegExp.Replace(strHTML, "");<BR> <BR> strOutput = Replace(strOutput, "&#060;", "&#060;");<BR> strOutput = Replace(strOutput, "&#062;", "&#062;");<BR> <BR> stripHTML = strOutput;<BR><BR> Set objRegExp = Nothing;<BR>}<BR><BR>Then I read into the function the following<BR><BR>string = res("Text"); //String from database<BR>stripHTML (string);<BR>Response.Write("&#060;td&#062;"+strin g+"&#060;/td&#062;");<BR><BR>The error I&#039;m getting is <BR><BR>Microsoft JScript runtime error &#039;800a138f&#039; <BR>Object expected <BR><BR>? <BR><BR>Any ideas<BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default What a mess

    You can&#039;t seem to decide whether to write JScript code or VBScript code!<BR><BR>VBScript doesn&#039;t use {...}<BR><BR>JScript doesn&#039;t use SET.<BR><BR>JScript doesn&#039;t have a REPLACE function (just a replace method on a string object).<BR><BR>JSscript doesn&#039;t...well, never mind. What you coded isn&#039;t close to legit JS code.<BR><BR>You didn&#039;t even call it correctly:<BR> stripHTML (string);<BR>JS doesn&#039;t *HAVE* "by ref" parameters, so you can&#039;t modify the argument to the function and have it visible in the caller. You needed to do<BR> string = stripHTML(string);<BR><BR>After you rewrite stripHTML to be JS code instead of a conglomeration of the two languages.<BR><BR>And next time show which line gets the error message? (Not that it matters in this case, since the code is so badly scrambled anyway.)<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts