Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Includes

  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Includes

    Okay imagine this is the main javasript its a short one but
    I just want to get te logic and if it is posibble
    Code:
    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

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is this in response to a user action on the page or is this done when the page is first loaded?
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #3
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    When the page loads:


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

    -james
    Last edited by jamescover; 08-25-2004 at 01:49 AM.
    "God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "

  • #4
    New Coder
    Join Date
    Mar 2004
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts
    On the users action;


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •