[Javascript] Convert raw HTML into a string
Mike Dougherty
mdougherty at pbp.com
Fri Aug 20 10:17:32 CDT 2004
i thought javascript's string.replace() function used regexp
= lvstrHTML.replace(/"/g,'""')
That's about the extend of my regexp understanding. I'm sure if that's the problem, you can get
much more help here from the regexp guru(s)
On Fri, 20 Aug 2004 10:27:00 +1200
"Clancy Jones" <clancyjones at hotmail.com> wrote:
>Howdy neighbours, I have a vb script function that I use for converting raw HTML into a string:
>
>function convertHTMLToString(paramHTML)
> dim lvstrHTML
> lvstrHTML = paramHTML
> lvstrHTML = replace(lvstrHTML,chr(34),chr(34)&chr(34))
> lvstrHTML = replace(lvstrHTML,""",chr(34)&chr(34))
> lvstrHTML = replace(lvstrHTML,vbCrLf,chr(34) &" & vbNewLine & _" & vbCrLf & chr(34))
> lvstrHTML = chr(34) & lvstrHTML & chr(34)
> convertHTMLToString = lvstrHTML
>end function
>
>I now want to replicate this function in javascript but am having a few problems. So far I've
>tried:
>
>function convertHTMLToString(paramHTML){
> var lvstrHTML
> lvstrHTML = paramHTML
> lvstrHTML = lvstrHTML.replace(chr(34),chr(34)+chr(34))
> lvstrHTML = lvstrHTML.replace(""",chr(34)+chr(34))
> return lvstrHTML
>}
>
>The first "replace" line is causing an "object expected" error.
>
>Can someone help out with this?
>
>Thanks,
>
>Clancy
>
>PS: The purpose of this is to provide a "Send this spreadsheet by email" function by grabbing the
>innerHTML of a DIV which contains dynamic table data, convert the raw HTML into a string and then
>assign it as the value of a hidden field. The string can then be used as the content for an HTML
>formatted email message.
>
>_________________________________________________________________
>Check out news, entertainment and more @ http://xtra.co.nz/broadband
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list