Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Jul 2006
    Posts
    49
    Plugin Contributions
    0

    Calling Javascript file from main page

    Is there a way that I can call my javascript file from my main page. I created a file: jscript_praiseandplayscroll.js and put it in includes/modules/pages/main_page_js/ folder. The line of code that I am trying to use to call it is: <script language="javascript" src="includes/modules/pages/main_page_js/jscript_praiseandplayscroll.js"></script>

    I've also tried putting the file in: includes/templates/praiseandplay/jscript/ folder, which would make the file global and then used: <script language="javascript" src="jscript_praiseandplayscroll.js"> to call it, and still, no results.

    Any help here would be greatly appreciated. The site is: www.praiseandplay.com/catalog

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Calling Javascript file from main page

    If the jscript_praiseandplayscroll.js script is something that must run from a specific spot on the page, you'll have to code the <script ..... jscript_praiseandplayscroll.js.... </script> part in to your template manually.

    However, if it is something that just needs to be loaded and available for other javascript function calls elsewhere in your templates, then putting it in the jscript folder (your second location above) is the right way to do it.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jul 2006
    Posts
    49
    Plugin Contributions
    0

    Re: Calling Javascript file from main page

    See, I think that that is what I did? I am trying to load it for a specific website and put the jscript_praiseandplayscroll.js in includes/modules/pages/main_page_js/ folder. The line of code that I am trying to use to call it is:
    <script language="javascript" src="includes/modules/pages/main_page_js/jscript_praiseandplayscroll.js"></script>

    which does want to work for some reason. I'm really confused because I think I am doing what you and the jscript instructions say to do, but to know avail.

    And I am also hard coding it into one of my sidebox templates, tpl_blank_sidebox1.php

  4. #4
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Calling Javascript file from main page

    What is "main_page_js" ? Zen Cart doesn't have such a page by default...
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Calling Javascript file from main page

    what does your jscript_praisenplayscroll.js file do ?

    Does is simply provide support for various js function calls in your template, or is IT supposed to do something specific on the screen all by itself?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Jul 2006
    Posts
    49
    Plugin Contributions
    0

    Re: Calling Javascript file from main page

    main_page_js is the name of a folder that i created to put javascript files into for my main page. The script is used for scrolling text. Useful if you have a lot of text you want to fit into a small table cell for example. Hope that helps.

  7. #7
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Calling Javascript file from main page

    can you share a URL?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  8. #8
    Join Date
    Jul 2006
    Posts
    49
    Plugin Contributions
    0

    Default Re: Calling Javascript file from main page


  9. #9
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Calling Javascript file from main page

    1. the .js file is being loaded in the header because you've located the file in the jscript folder for your template. This is probably what you want, so this is okay:
    HTML Code:
    <script type="text/javascript" src="includes/templates/praiseandplay/jscript/jscript_praiseandplay.js"></script>
    2. In your bottom centerbox you have a commented copy of the script with a big long file path that will not work on a webpage because the path is too long:
    Code:
            <!-- <script language="javascript" src="/kunden/homepages/19/d158832336/htdocs/praiseandplay/catalog/includes/modules/pages/main_page_js/jscript_praiseandplayscroll.js"></script> -->
    It can likely be removed.

    3. I decided to take a look at the js code you're using to see how it's supposed to invoke the scrolling .... only to discover that the code in the file has nothing to do with scrolling .... instead it's css-top-menu code ....
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  10. #10
    Join Date
    Jul 2006
    Posts
    49
    Plugin Contributions
    0

    Re: Calling Javascript file from main page

    Thats the menu I was using before. I've deleted it now and have made some changes to the site, but the javascript still isn't working. I haven't felt this lost programming in a long time. I have no idea what to do. I believe that I have followed the instructions in the jscript text file to a tee. Is there something else that I might be doing wrong? Once again, any help would be greatly appreciated.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Calling Images With Javascript
    By GodfatherAntiques in forum General Questions
    Replies: 7
    Last Post: 27 Jan 2011, 01:07 AM
  2. javascript calling problem
    By sn_aneesh in forum Basic Configuration
    Replies: 1
    Last Post: 28 Feb 2009, 06:10 PM
  3. calling javascript for thumbnail image
    By stevotj in forum Templates, Stylesheets, Page Layout
    Replies: 17
    Last Post: 12 Jan 2009, 08:54 AM
  4. Custom Javascript Calling images from unsecure folder
    By CoolCarPartsOnline in forum General Questions
    Replies: 0
    Last Post: 29 Dec 2008, 08:59 AM

Posting Permissions

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