#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    2
    Rep Power
    0
    I want to pass a variable from a include file to a Javascript function which will be accessed by around 300 pages.
    The url.txt contains
    url=123.123.123.80
    I included it as:
    <!--#INCLUDE FILE="url.txt"-->
    When i tried to access
    function text(){
    alert(url);
    window.open("url/text.asp)}
    This was not working.Can u pls send me the solution.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    27
    Rep Power
    0
    I think you need to do it like this -

    Use this syntax to include your file, and make it a .js file -

    <script language="javascript" src="filename.js"></script>

    In your filename.js file do something like this -

    var url="10.0.0.16";

    You should then be able to reference the url variable from the main page. Hope that helps!

    Matt.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    2
    Rep Power
    0
    Thanks a lot.It was very useful.

Similar Threads

  1. ZoneLabs adds javascript to my files
    By luinetti in forum JavaScript Development
    Replies: 3
    Last Post: November 26th, 2003, 06:22 PM
  2. Including files in PHP
    By javakills in forum PHP Development
    Replies: 1
    Last Post: September 17th, 2003, 01:23 PM
  3. javascript calendar problem about including time
    By munna in forum JavaScript Development
    Replies: 1
    Last Post: August 1st, 2003, 06:05 AM
  4. including files from entire directory
    By summercom in forum PHP Development
    Replies: 13
    Last Post: March 11th, 2003, 10:38 PM
  5. Back button and including files - error!
    By dreamstring in forum HTML Programming
    Replies: 1
    Last Post: November 11th, 2002, 12:44 AM

IMN logo majestic logo threadwatch logo seochat tools logo