Forum Moderators: coopster
I am trying to create a javascript variable that hold the value or a php variable. The PHP var comes from a database and holds html text. I can do all this correctly but the problem I have is that the html text is multiple lines of code. The JavaScript Variable cannot handle that because the text needs to be all on one line, and since the text is dynamic adding end line code to the JS var is not good. I am not very knowledgeable the JS syntax but I can understand anything you throw at me.
Here's what I have:
var caltext=new Array()
//Set submenu contents. Expand as needed. For each content, make sure everything exists on ONE LINE. Otherwise, there will be JS errors.
caltext[1]='<?php echo $CalendarText[1];?>'
caltext[2]='<?php echo $CalendarText[2];?>'
caltext[3]='<?php echo $CalendarText[3];?>'
This code creates text for the calendarday that I have set on an onClick event. This all work ideally. but this is the out I get to the browser:
menu[1]='<table width="100%" border="1" cellpadding="2" cellspacing="0" bordercolor="#993300"><tr><td align=center valign=middle bgcolor="#FF9900"><strong><font color="#993300" size="4" face="Verdana, Arial, Helvetica, sans-serif">Tuesday, October 19, 2004</td></tr><tr><td><OL>
<LI>This is a Test</LI>
<LI>This is a Test</LI>
<LI>This is a Test</LI>
<LI>This is a Test</LI></OL></font></strong></td></tr></table>'
menu[2]='<table width="100%" border="1" cellpadding="2" cellspacing="0" bordercolor="#993300"><tr><td align=center valign=middle bgcolor="#FF9900"><strong><font color="#993300" size="4" face="Verdana, Arial, Helvetica, sans-serif">Wednesday, October 20, 2004</td></tr><tr><td><OL>
<LI>This is a Test</LI>
<LI>This is a Test</LI>
<LI>This is a Test</LI>
<LI>This is a Test</LI></OL></font></strong></td></tr></table>'
menu[3]='<table width="100%" border="1" cellpadding="2" cellspacing="0" bordercolor="#993300"><tr><td align=center valign=middle bgcolor="#FF9900"><strong><font color="#993300" size="4" face="Verdana, Arial, Helvetica, sans-serif">Thursday, October 21, 2004</td></tr><tr><td><OL>
<LI>This is a Test</LI>
<LI>This is a Test</LI>
<LI>This is a Test</LI>
<LI>This is a Test</LI></OL></font></strong></td></tr></table>'
Now I have Multi-line text that cannot be in a JavaScript Variable. Is there another way I can set the variable to hold the data?