View Full Version : Includes

08-24-2004, 03:11 PM
Okay imagine this is the main javasript its a short one but
I just want to get te logic and if it is posibble

if (choice == 1) {
var alert = " The first "
table = "<tr><td>" + alert + "Table</td></tr>"

Is there any way to include

"<tr><td>" + alert + "Table</td></tr>"

by a external file?Including the variable alert I did use?
Just putting this in an include an declaring it there like
string = "<tr><td>" + alert + "Table</td></tr>"

and calling it in the main js with
<script language="JavaScript" src="td.tpl"></script>
doesnt work..

Please help me out

Roy Sinclair
08-24-2004, 08:51 PM
Is this in response to a user action on the page or is this done when the page is first loaded?

08-25-2004, 02:44 AM
When the page loads:

<table border="0" cellpadding="0" cellspacing="0" valign="top">
<td valign="top">
<script type="text/javascript">
if (choice == 1) {
var alert = " The first ";
var table = alert + "Table";


08-25-2004, 11:16 AM
On the users action;