SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Threaded View

  1. #1
    SitePoint Zealot websalacarta's Avatar
    Join Date
    May 2003
    Location
    Spain
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question load javascript file dinamically

    Hi,
    I´m using this javascript to load one js file (params.js)

    Code:
    loadScript:function(file){
     	script = document.createElement('script');
      	script.src = file;
    	script.type = 'text/javascript';
    	document.getElementsByTagName("head")[0].appendChild(script);
    }
    params.js has only a few vars
    Code:
    paramPant = new Array();
    paramPant['param1'] = 5;
    paramPant['param2'] = 6;
    when this file is loaded, it´s suposse I can access paramPant value.

    It works correctly with IE6, but it doesn´t work with Firefox2 (it says paramPant is not defined)

    any idea why it doesn´t work with firefox?

    thanks very much.
    Last edited by websalacarta; Aug 14, 2007 at 02:45. Reason: write it easier to understand


Bookmarks

Posting Permissions

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