SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Apr 2005
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript inside javascript

    Is it possible to run a javascript code inside another javascript .. eg
    I wish to run a google analytics javascript code inside another javascript on my web page. .

    possible ?

  2. #2
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Saul

  3. #3
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  4. #4
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Haha, I knew this was coming. But so long as you know what you're doing, evil is relative. Although there's a saying that if you need eval, you probably need to reconsider your program.
    Saul

  5. #5
    SitePoint Enthusiast
    Join Date
    Jul 2008
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is the way that i call a .js file from within another .js file:

    switch (deconumber)
    {
    case 1 : document.write('<scr' + 'ipt type="text\/javascript" src="http:\/\/place your domain here\/this is\/the path\/to your .js file"><\/script>'); break;
    :
    :
    :
    }

    i chose to place mine within a "switch" statememt, it could also be used like this:

    document.write('<scr' + 'ipt type="text\/javascript" src="http:\/\/yourdomain.com\/directory\/your.js"><\/script>');

    the "directory" cane be left out if its in the same place its being called.

    hope this helps....
    john


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
  •