SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    script me to the moon...

    Your challengs is simple. Explain to me how I can achieve the equivilent of an include in javascript.

    eg:
    Code:
    <script language="javascript" type="text/javascript">
    <!--
    if ( 'foo' == foo ) {
       // I want to "include"/link to an external 
       // javascript source file here!
    }
    -->
    </script>
    Can it be done? (don't tell me it can't be!)

  2. #2
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if (foo == "foo"){
    document.write("<script src='source of file' language='javascript1.2'></script>");
    }else if(foo == "foobar"){
    document.write("<script src='source of other file' language='javascript1.2'></script>");
    }

    Yes it can be done
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.

  3. #3
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool if else otherwise maybe sort-of undecided not sure

    Cool Thanks, I tried something along those lines, but had my quotes tangled up Got it now

  4. #4
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: if else otherwise maybe sort-of undecided not sure

    Originally posted by freakysid
    Cool Thanks, I tried something along those lines, but had my quotes tangled up Got it now
    Thats a killer in Js. Glad it works.
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.


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
  •