Thread: Javascript

Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    634
    Plugin Contributions
    0

    Idea or Suggestion Javascript

    In product info display I want to open a javascript popup; in templates/mytemplate/common/tpl_header.php I've add this:
    HTML Code:
    <script type="text/javascript" language="javascript">
    function ShowMenu(URL, WinTitle, Winwidth, Winheight, WinLeft, WinTop){
    attr = "resizable=no,width=" + Winwidth + ",height=" + Winheight + ",screenX=" + WinLeft + ",screenY=" + WinTop + ",left=" + WinLeft + ",top=" + WinTop + "";
    msgWindow=open(URL, WinTitle, attr);
    if (msgWindow.opener == null) msgWindow.opener = self;
    }
    </script>
    after the first ?>
    This javascript is called by:
    HTML Code:
    define('registrati', '...questo prodotto puņ costarti molto meno! <a href="javascript:ShowMenu(\'buono_sconto.htm\',\'buono sconto\',600,500,2,95)"> click qui</a>');
    in languages/italian.php
    but it don't work in IE, work only in firefox!
    Try, please:
    http://www.100asa.it/datalogic-kit-t...1mb-p-881.html
    Thanks for suggestion

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

    Default Re: Javascript

    You are confusing the various available methods.

    Either use a .js file, or embed the javascript directly.

    1. Using an external .js file is documented here:
    http://www.zen-cart.com/wiki/index.p...s_-_Javascript
    You are using a link to this file:
    includes/templates/gloss_blue/jscript/jscript_showmenu.js
    ... but you are including the <script> and </script> tags in the file, which causes syntax errors.

    2. You are embedding the same code as you have in the includes/templates/gloss_blue/jscript/jscript_showmenu.js file directly in your template file. Having it twice causes duplicate function declaration which causes errors or at least confusion to the browser.
    Code:
    <script type="text/javascript" language="javascript">
    function ShowMenu(URL, WinTitle, Winwidth, Winheight, WinLeft, WinTop){
    attr = "resizable=no,width=" + Winwidth + ",height=" + Winheight + ",screenX=" + WinLeft + ",screenY=" + WinTop + ",left=" + WinLeft + ",top=" + WinTop + "";
    msgWindow=open(URL, WinTitle, attr);
    if (msgWindow.opener == null) msgWindow.opener = self;
    }
    </script>
    Use one approach or the other.
    .

    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
    Oct 2006
    Location
    Italy
    Posts
    634
    Plugin Contributions
    0

    Default Re: Javascript

    Thanks very much: I'm using only .js file, and all works!

 

 

Similar Threads

  1. Javascript
    By Nick1973 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 16 Apr 2009, 11:32 AM
  2. Javascript
    By soundbwoy in forum Templates, Stylesheets, Page Layout
    Replies: 14
    Last Post: 29 Oct 2008, 09:42 PM

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