1. Welcome! Please take a few seconds to create your free account to post threads, make some friends, remove a few ads while surfing and much more. ClutchFans has been bringing fans together to talk Houston Sports since 1996. Join us!

Javascript, Jquery (oh myy....) Any semi-experts out there?

Discussion in 'BBS Hangout' started by what, Sep 15, 2012.

  1. what

    what Member

    Joined:
    Dec 4, 2003
    Messages:
    14,586
    Likes Received:
    2,553
    If so, question 1:

    Right or wrong: in order to implement a .js file the process is as follows:

    1. Upload the file using an ftp program to the desired location in a folder under public_html.

    2. Add the script location to your .php file <head> in this case:

    <script type="text/javascript" src="./javascripts/pagescroller.js"></script>


    Question 2. In the following example, does "./javascripts/pagescroller.js" point to public_html/javascipts/ folder or do I need to remove the "." and replace it with something else. I would assume it would be: "public_html/javascripts/ is what I'd need. However, in some of my other scripts in my template, I've seen this bit of code: src="<?php echo $this->baseurl ?> followed by the folder location.

    Possibly I don't need the "." or public_html either and just /javascripts/pagescroller.js as it knows to look in public_html. Is that true?
     
  2. what

    what Member

    Joined:
    Dec 4, 2003
    Messages:
    14,586
    Likes Received:
    2,553

    HTML:
    <script type="text/javascript" src="./javascripts/pagescroller.js"></script>
     
  3. Air Langhi

    Air Langhi Contributing Member

    Joined:
    Aug 26, 2000
    Messages:
    21,623
    Likes Received:
    6,257
    You should use google cdn unless you are customizing your jquery files.

    https://developers.google.com/speed/libraries/devguide

    I think everything is referenced from your document root folder so no need to have that in your path.
     
  4. what

    what Member

    Joined:
    Dec 4, 2003
    Messages:
    14,586
    Likes Received:
    2,553
    so it would be:
    HTML:
    <script type="text/javascript" src="/javascripts/pagescroller.js"></script>
    if the .js file is in a folder called javascripts, that is. Is that what you are saying?
     
  5. heypartner

    heypartner Contributing Member

    Joined:
    Oct 27, 1999
    Messages:
    62,564
    Likes Received:
    56,281
    btw: this is not a javascript issue. It is a IIS or Apache issue. The same answer would apply to images, too. Like this

    /images/myimage.jpg

    post the actual URL for your php. Say your php file runs at this location:

    http://www.mywebsite.com/hello.php
     

Share This Page

  • About ClutchFans

    Since 1996, ClutchFans has been loud and proud covering the Houston Rockets, helping set an industry standard for team fan sites. The forums have been a home for Houston sports fans as well as basketball fanatics around the globe.

  • Support ClutchFans!

    If you find that ClutchFans is a valuable resource for you, please consider becoming a Supporting Member. Supporting Members can upload photos and attachments directly to their posts, customize their user title and more. Gold Supporters see zero ads!


    Upgrade Now