[Javascript] Convert raw HTML into a string
Clancy Jones
clancyjones at hotmail.com
Thu Aug 19 17:27:00 CDT 2004
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
More information about the Javascript
mailing list