Click to See Complete Forum and Search --> : HTML variable?


florida
12-20-2002, 11:03 AM
Post Preview:
Need to put a variable to substitute HTML data. Is it possible??

Here the HTML that I have which is tucked in a Javascript:


<table bgcolor="#00ff00" border=0 cellpadding="0" cellspacing="0" width="100%" height="100%"
align="left"><tr><td><a href="http://mypath/home.html">myurl</a></td></tr></table>;

How can I do this??

var test = "<table bgcolor="#00ff00" border=0 cellpadding="0" cellspacing="0" width="100%"
height="100%" align="left"><tr><td>"


Here is how I want this variable to work.
test<a href="http://mypath/home.html">myurl</a></td></tr></table>;

AdamGundry
12-20-2002, 11:15 AM
Use single quotes around the outside of the variable, like this:

var test = '<table bgcolor="#00ff00" border=0 cellpadding="0" cellspacing="0" width="100%"
height="100%" align="left"><tr><td>';

You can also put a backslash (\) in front of a double-quote symbol to leave it in the string, but single quotes are easier.

Adam