SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: includes

  1. #1
    SitePoint Enthusiast DaDeViL's Avatar
    Join Date
    Aug 2003
    Location
    USA
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    includes

    is there any other way to include a js file other than this:

    <SCRIPT SRC="js.js"></SCRIPT>

    i want to do it because i need to put a variable in place of js, so it would be:
    res = screen.width;

    <SCRIPT SRC="res.js"></SCRIPT> where variable was determined earlier.

    but i dont think i can do that

  2. #2
    SitePoint Guru asterix's Avatar
    Join Date
    Jun 2003
    Posts
    847
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, you can't do that. Do you have access to a server side script technology? You could do:

    Code:
    <SCRIPT SRC="js.js?screen.width=1024"></SCRIPT>
    And then on the server side send the corrsct script...

  3. #3
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    yes, you can either use the method here.....
    http://www.sitepointforums.com/showt...hreadid=123158
    or use.............
    Code:
    newJS=new Array("js1","js2","js3" )
    document.write('<scr'+'ipt src="'+newJS[n]+'.js"></scr'+'ipt'> )
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if


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
  •