Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2005
    Thanked 0 Times in 0 Posts

    Question calling a variable into an external js file

    i have what is a simple problem (i think) but im stumped...i just started learning this stuff on my own...so ..here we go

    im using a javascript menu tree in a html file...no problems...i call an external .js file that configures the menu...heres the code

    d = new dTree('d');

    d.config.useSelection = "false";
    d.config.useCookies = "true";
    d.config.closeSameLevel = "true";

    d.add(0,-1,'Main Index','D:/mp3');
    d.add(31,2,'Bluegrass Compilations','D:/mp3/++Compilations++/Bluegrass Compilations','','','img/folder3.gif','img/Folder3open.gif');



    mytree.openTo(4, true);

    This all works fine...but what i need is that last line to be a variable called from the html page the script is loaded from...cause it is diffenent from each page....i know i could just plug the script into the html page but i have tonnes of these pages so i externallized the .js file so as not to have to update each html page individually....again it works...i just dont know how to set the variable on the html and then call it in the js.....

    the variable would be where the number 4 is..all it does is tell the tree to expand to that position ...i could live without it but heck i know i should be able to do it and its driving me crazy
    Last edited by buddy; 01-13-2005 at 12:43 PM.

  2. #2
    New to the CF scene
    Join Date
    Jan 2005
    Thanked 0 Times in 0 Posts

    thanx...ive figured it out

    i just had to assign the variable name at the top of the html page like this

    <script type="text/javascript">
    var position = "32"

    then change the js file to


    glad i figured it out myself....lol...i new it was easy but i did everything else BUT this...lol.....thanx anyways


Posting Permissions

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