HTML code as javascript string

Hi there,
got a problem that i cant find no solid solution for.
this is the situation

I made a dhtml “floatie” for a client, that displays detailed information about a new message when you hover over the link. Now the descriptions are dynamic, recently I put a wyswig to enter the descriptions from the admin panel.

Now it is throwing a JS error because characters like : , " .’ " are not supported to show on that floatie, i will give you an example

onMouseover=“showfloatie(‘<img src="/new_template/components/ui_tags/1616/about.png">  <span class="bdyMain">
<b>Matt Trinneer</b><br> this is a message to mattEvent: test
New Status Level: Level II <br> 1</span>’, event)”
onMouseout=“hidefloatie()”

this code fails because of the ‘:’

is there any library/snippet/function that can take an html string and change it to a javascript complaint string, also, my scripting language is coldfusion, can i use something from the servers end ( other than replacestring)

thanks very much

sincerely,

dont understant the problem


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
  <title></title>
<script language="JavaScript" type="text/javascript">
<!--
function showfloatie(obj,txt){
 obj.innerHTML=txt
}
//-->
</script></head>

<body>
<div style="width:200px;height:100px;background-color:red;"
onMouseover="showfloatie(this,'<img src=http://www.vicsjavascripts.org.uk/StdImages/Up1.gif >&nbsp;&nbsp;<span class=&quot;bdyMain&quot;><b>, : Matt Trinneer</b><br> this is a message to mattEvent: test New Status Level: Level II <br> 1</span>', event)"></div>

</body>

</html>

hi again.
ill rephrase,
is there any way to take an html code of file
let say this code

"<input type=“text” name=“email”> please enter : email "

and stick it as a javascript string? ( it doesnt take special characters like ",'.:slight_smile:

The code posted by vwphillips shows this HTML passed to the javascript

<img src=http://www.vicsjavascripts.org.uk/StdImages/Up1.gif >&nbsp;&nbsp;<span class=&quot;bdyMain&quot;><b>, : Matt Trinneer</b><br> this is a message to mattEvent: test New Status Level: Level II <br> 1</span>

It contains “special” characters (some are escaped), and the script works.

aracters (some are escaped), and the scri

to clarrify

to escape a charator(literal interpretation, I realy mean this chactor)
prefix charactor with \