SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard
    Join Date
    Dec 2004
    Location
    At My Desk!!
    Posts
    1,642
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Include doesnt appear to work

    I have the following code and it doesn't work. I have used this on other sites in the past but it doesn't seem to work on this server, I presume this something to do with the files being included. Can a server stop file from being included?

    The error is: "Effect is not defined"

    HTML Code:
    <script src="scriptaculous/lib/prototype.js" type="text/javascript"></script>
    <script src="scriptaculous/src/scriptaculous.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
    
    	// this array consists of the id attributes of the divs we wish to alternate between
    	var divs_to_fade = new Array('box-1', 'box-2');
    
    	// the starting index in the above array.  It should be set to the value of the div which doesn't have the CSS Display property set to "none"
    	var i = 0;
    
    	// the number of milliseconds between swaps.  Default is five seconds.
    	var wait = 5000;
    
    	// the function that performs the fade
    	function swapFade() {
    		Effect.Fade(divs_to_fade[i], { duration:2, from:2.0, to:0.0 });
    		i++;
    		if (i == 4) i = 0;
    		Effect.Appear(divs_to_fade[i], { duration:2, from:0.0, to:2.0 });
    	}
    
    	// the onload event handler that starts the fading.
    	function startPage() {
    		setInterval('swapFade()', wait);
    	}
    
    </script>
    Thanks in advance
    "Am I the only one doing ASP.NET in Delphi(Pascal)?"

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    16,445
    Mentioned
    160 Post(s)
    Tagged
    1 Thread(s)
    AFAIK, scriptaculous.js loads in util.js, effects.js, dragdrop.js, and controls.js
    Are those files available on the server?

  3. #3
    SitePoint Wizard
    Join Date
    Dec 2004
    Location
    At My Desk!!
    Posts
    1,642
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes they are all in the same file set up as I downloaded them in and they are all uploaded to the server in a scriptaculous folder. I have tried other Javascript bits on this site and none of them seem to work if I put them in an external JS file.
    "Am I the only one doing ASP.NET in Delphi(Pascal)?"

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    From the page location, check that the script can be found.

    For example:
    www. mysite.com/samplelocation/page.html
    www. mysite.com/samplelocation/scriptaculous/lib/prototype.js
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Wizard
    Join Date
    Dec 2004
    Location
    At My Desk!!
    Posts
    1,642
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This has now been resolved. Silly me programming to late at night I am using htaccess and forgot to put the full path in for my includes
    "Am I the only one doing ASP.NET in Delphi(Pascal)?"


Bookmarks

Posting Permissions

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