inserting javascript variable into html?

doniett

New member
This is an example of what am trying to do

<html>

<body>

<script type="text/javascript">
var month="August"; //code to get current month
var table = '<table name =calender border=1 width=294 id=tab>';
table += '<tr><th colspan=1> << </th> <th colspan=5> month </th>';
table += '</tr></table>';
document.write(table);
</script>

</body>
</html>

The problem is, the table outputs month instead of August. How to i pass a javascript variable into html?

Please help
Thanks Doug but

table += '<tr><th colspan=1> << </th> <th colspan=5>' + month + '</th>';

doesn't work it outputs + month + instead of August
Got it to work, thanks Doug and Ron
 
Back
Top