Results 1 to 9 of 9
  1. #1
    Join Date
    Jul 2006
    Posts
    49
    Plugin Contributions
    0

    javascript for single page

    This javascript code that I have downloaded is supposed to be loaded inline inside an html page (anywhere between the body tags). I checked out all the forum topics I could find on this particular subject, and have tried to follow each thoroughly. My javascript which is just a verticle scroller still will not show up, and I have no idea why. I have a file called jscript_pandpscroll.js in the overrided jscript folder, I also have the script located in between the header tags in html_header.php, and also have a copy of the jscript_pandpscroll.php in includes/modules/pages/index/ as well which is the location that I am trying to call with this line of code: <script type="text/javascript" src="/includes/modules/pages/index/jscript_pandpscroll.js"></script>

    I read somewhere that there should be a function call between the two script tags, but like I said the script I think was meant to be inline. And when trying to search the code for the right function to call, i am even more frustrated. Is there anyone who can help, I am completely lost and confused? Please let me know if you need me to post the code for the script.


    The website is: www.praiseandplay.com/catalog
    Last edited by praiseandplay; 5 Aug 2006 at 08:12 AM.

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

    Default Re: javascript for single page

    Yes, your script must be called inline.

    Dump the code right in your template file where you want it to run. Do not use the jscript_xxxx methods ... those are for loading support components, not for inline javascript.




    This is a continuation of earlier thread: http://www.zen-cart.com/forum/showthread.php?t=42542
    .

    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: javascript for single page

    Thank you for your prompt reply. Loading the code inline is much much easier, but I have also tried to do that as well and still nothing. It seems like anything that I try to put between the script tags on define_main_page.php does not get read. I've removed the script from the header, and from the index folder as well from the overrided jscript folder. I did a straight copy and paste from the website and put it inline into my define_main_page.php.

    Here is part of the code that I have inside define_main_page.php :


    <td height=100px align="center">

    <!-- Start of JavaScript -->
    <script language="javascript">

    //Vertical Scroller v1.2- by Brian of www.ScriptAsylum.com
    //Updated for bug fixes
    //Visit JavaScript Kit (http://javascriptkit.com) for script

    //ENTER CONTENT TO SCROLL BELOW.
    var content='<p>Visit <a href="http://www.javascriptkit.com">JavaScript Kit</a> for JavaScript tutorials and over 400 <font color="#FF0000">free</font> scripts</p><p><a href="http://freewarejava.com">Freewarejava.com</a>- direct links to Java applets and resources</p><p>Stay up to date on current news and events. Visit <a href="http://www.msnbc.com">MSNBC.com</a></p><p><a href="http://www.dynamicdrive.com">Dynamic Drive</a> is your definitive source for DHTML scripts and components.</p>';

    var boxheight=150; // BACKGROUND BOX HEIGHT IN PIXELS.
    var boxwidth=150; // BACKGROUND BOX WIDTH IN PIXELS.
    var boxcolor="#FFF6e9"; // BACKGROUND BOX COLOR.
    var speed=50; // SPEED OF SCROLL IN MILLISECONDS (1 SECOND=1000 MILLISECONDS)..
    var pixelstep=2; // PIXELS "STEPS" PER REPITITION.
    var godown=false; // TOP TO BOTTOM=TRUE , BOTTOM TO TOP=FALSE

    // DO NOT EDIT BEYOND THIS POINT

    var outer,inner,elementheight,ref,refX,refY;
    var w3c=(document.getElementById)?true:false;
    var ns4=(document.layers)?true:false;
    var ie4=(document.all && !w3c)?true:false;
    var ie5=(document.all && w3c)?true:false;
    var ns6=(w3c && navigator.appName.indexOf("Netscape")>=0)?true:false;
    var txt='';
    if(ns4){
    txt+='<table cellpadding=0 cellspacing=0 border=0 height='+boxheight+' width='+boxwidth+'><tr><td>';
    txt+='<ilayer name="ref" bgcolor="'+boxcolor+'" width='+boxwidth+' height='+boxheight+'></ilayer>';
    txt+='</td></tr></table>'
    txt+='<layer name="outer" bgcolor="'+boxcolor+'" visibility="hidden" width='+boxwidth+' height='+boxheight+'>';
    txt+='<layer name="inner" width='+(boxwidth-4)+' height='+(boxheight-4)+' visibility="hidden" left="2" top="2" >'+content+'</layer>';
    txt+='</layer>';
    }else{
    txt+='<div id="ref" style="position:relative; width:'+boxwidth+'; height:'+boxheight+'; background-color:'+boxcolor+';" ></div>';
    txt+='<div id="outer" style="position:absolute; width:'+boxwidth+'; height:'+boxheight+'; visibility:hidden; background-color:'+boxcolor+'; overflow:hidden" >';
    txt+='<div id="inner" style="position:absolute; visibility:visible; left:2px; top:2px; width:'+(boxwidth-4)+'; overflow:hidden; cursor:default;">'+content+'</div>';
    txt+='</div>';
    }
    document.write(txt);

    function getElHeight(el){
    if(ns4)return (el.document.height)? el.document.height : el.clip.bottom-el.clip.top;
    else if(ie4||ie5)return (el.style.height)? el.style.height : el.clientHeight;
    else return (el.style.height)? parseInt(el.style.height)arseInt(el.offsetHeight);
    }

    function getPageLeft(el){
    var x;
    if(ns4)return el.pageX;
    if(ie4||w3c){
    x = 0;
    while(el.offsetParent!=null){
    x+=el.offsetLeft;
    el=el.offsetParent;
    }
    x+=el.offsetLeft;
    return x;
    }}

    function getPageTop(el){
    var y;
    if(ns4)return el.pageY;
    if(ie4||w3c){
    y=0;
    while(el.offsetParent!=null){
    y+=el.offsetTop;
    el=el.offsetParent;
    }
    y+=el.offsetTop;
    return y;
    }}

    function scrollbox(){
    if(ns4){
    inner.top+=(godown)? pixelstep: -pixelstep;
    if(godown){
    if(inner.top>boxheight)inner.top=-elementheight;
    }else{
    if(inner.top<2-elementheight)inner.top=boxheight+2;
    }}else{
    inner.style.top=parseInt(inner.style.top)+((godown)? pixelstep: -pixelstep)+'px';
    if(godown){
    if(parseInt(inner.style.top)>boxheight)inner.style.top=-elementheight+'px';
    }else{
    if(parseInt(inner.style.top)<2-elementheight)inner.style.top=boxheight+2+'px';
    }}}

    window.onresize=function(){
    if(ns4)setTimeout('history.go(0)', 400);
    else{
    outer.style.left=getPageLeft(ref)+'px';
    outer.style.top=getPageTop(ref)+'px';
    }}

    window.onload=function(){
    outer=(ns4)?document.layers['outer']ie4)?document.all['outer']:document.getElementById('outer');
    inner=(ns4)?outer.document.layers['inner']ie4)?document.all['inner']:document.getElementById('inner');
    ref=(ns4)?document.layers['ref']ie4)?document.all['ref']:document.getElementById('ref');
    elementheight=getElHeight(inner);
    if(ns4){
    outer.moveTo(getPageLeft(ref),getPageTop(ref));
    outer.clip.width=boxwidth;
    outer.clip.height=boxheight;
    inner.top=(godown)? -elementheight : boxheight-2;
    inner.clip.width=boxwidth-4;
    inner.clip.height=elementheight;
    outer.visibility="show";
    inner.visibility="show";
    }else{
    outer.style.left=getPageLeft(ref)+'px';
    outer.style.top=getPageTop(ref)+'px';
    inner.style.top=((godown)? -elementheight : boxheight)+'px';
    inner.style.clip='rect(0px, '+(boxwidth-4)+'px, '+(elementheight)+'px, 0px)';
    outer.style.visibility="visible";
    }
    setInterval('scrollbox()',speed);
    }
    </script>

    <p align="center"><font face="arial" size="-2">This free script provided by</font><br>
    <font face="arial, helvetica" size="-2"><a href="http://www.javascriptkit.com">JavaScript
    Kit</a></font></p>

    </td>

    Is there something wrong with this?

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

    Default Re: javascript for single page

    Nothing "wrong" as far as I can tell ... other than it's not working
    .

    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
    Jul 2006
    Posts
    49
    Plugin Contributions
    0

    Default Re: javascript for single page

    Yeah, I know its even more difficult for you to tell from your end what's wrsong, but I do thank you for trying.

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

    Default Re: javascript for single page

    I copied and pasted all of the content from my define_main_page.php into a file called test1.html. You can look here if you would want to see what it looks like:

    www.praiseandplay.com/test1.html

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

    Re: javascript for single page

    Well, I realize the problem is that my define_main_page.php will not allow anything between the <script> and </script> tags to be read. Does anyone know if there is some sort of switch in zen cart to turn on/off javascript?

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

    Idea or Suggestion Re: javascript for single page

    [FONT="Arial"]Well I never quite figured out the problem, but I did find another solution for the script (vertical scroller) that does not need the use of the script tags on your web page, instead you just basically copy and paste the script to your html_header.php file, and then also copy and paste the onClick javascript commands to where you want the scroll box to appear on your website. If anyone else happens to run into this problem as well you can get the scroll box here: http://www.dynamicdrive.com/dynamicindex2/cmarquee2.htm

    http://www.dynamicdrive.com/ has a lot of other nice scripts as well, finding the one you might take some time, but its worth it.
    [/FONT]

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

    Default Re: javascript for single page

    Quote Originally Posted by praiseandplay
    [FONT="Arial"][SIZE="3"]I did find another solution for the script (vertical scroller) that does not need the use of the script tags on your web page, instead you just basically copy and paste the script to your html_header.php file
    The part that you paste into your html_header.php file can be placed in the jscript_blah.js or jscript_blah.php file in your modules/pages/PAGE or templates/YOURTEMPLATE/jscript folder.

    Then your onclick and other things should work when coded inline.
    .

    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.

 

 

Similar Threads

  1. v151 Product pictures in single, vertical column on front page under New Products for May
    By 500N in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 26 May 2014, 05:55 PM
  2. Looking for single page check out in v139d
    By rej2k7 in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 11 Aug 2010, 10:20 AM
  3. specify javascript file for specific ez-page
    By orchidlake in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 28 Jan 2010, 12:47 AM
  4. Single page and single product shopping cart.
    By adamgh in forum General Questions
    Replies: 2
    Last Post: 21 Mar 2009, 10:31 PM
  5. Setting up a single page for a moron.
    By vanlutz in forum General Questions
    Replies: 2
    Last Post: 1 Oct 2008, 07: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