Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Convert raw HTML into a string
- From: clancyjones at hotmail.com (Clancy Jones)
- Subject: [Javascript] Convert raw HTML into a string
- Date: Thu Aug 19 17:27:07 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
- Follow-Ups:
- [Javascript] Convert raw HTML into a string
- From: Hassan Schroeder
- [Javascript] Convert raw HTML into a string
- From: Mike Dougherty
- [Javascript] Convert raw HTML into a string
- Prev by Date: [Javascript] Print the contents of a variable into the source
- Next by Date: [Javascript] Convert raw HTML into a string
- Previous by thread: [Javascript] Print the contents of a variable into the source
- Next by thread: [Javascript] Convert raw HTML into a string
- Index(es):