Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Feb 2008
    Location
    London, UK
    Posts
    44
    Plugin Contributions
    0

    Default javascript in header

    Hi Zenners,

    I want to add 3 rotating images in my header. I am obviously not going to ask anyone if this works, I can check that myself but I want to know if my methodology is correct as I am not very familiar with jscript.

    1. I make 3 images all the same size and file extension name1.gif , name2.gif, name3.gif and ftp to templates/my_template/images/

    2. In a notepad file paste the code below and save as jscript_email_name.js and ftp to includes/templates/my_template/jscript/

    <script type="text/javascript" language="JavaScript">
    <!-- Copyright 2002 Bontrager Connection, LLC
    //
    NumberOfImagesToRotate = 3;

    // Specify the first and last part of the image tag.

    FirstPart = '<img src="name';
    LastPart = '.gif" height="150" width="200">';

    function printImage() {
    var r = Math.ceil(Math.random() * NumberOfImagesToRotate);
    document.write(FirstPart + r + LastPart);
    }
    //-->
    </script>

    3. To get the revolving images onto the header of all my pages I add the line below to common/tpl_header.php

    <script type="text/javascript" language="JavaScript"><!--
    printImage();
    //--></script>

    My questions are:
    1.As I have named my js file “jscript_email_name.js” how will the code above call the script as there is no reference to the name or file path.
    2.is /my_template/common/tpl_header.php the correct file to edit to add the revolving images to all headers in my site

    Any pointers would be hugely appreciated. Thanks Zenners

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: javascript in header

    The actual js file should be in your /includes/templates/your_template/jscript folder
    Zen-Venom Get Bitten

 

 

Similar Threads

  1. JavaScript button in header
    By DontBlink7 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 2 Apr 2011, 01:31 AM
  2. Javascript Rollovers In Header
    By giant_robot in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 17 Jun 2009, 01:00 AM
  3. insert a javascript for a slideshow in header
    By supersnow in forum Templates, Stylesheets, Page Layout
    Replies: 22
    Last Post: 7 May 2009, 12:02 PM
  4. Where to enter a javascript that goes in header?
    By ckosloff in forum General Questions
    Replies: 6
    Last Post: 27 Dec 2008, 04:39 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