PDA

View Full Version : Ultimate Fade-In slide show Validation Problems



Joolsy_M
07-10-2007, 11:03 AM
1) Script Title: Ultimate Fade-In slide show

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm

3) Describe problem: I think the fade-in slide show is great and it does exactly what I need, however... when I validate the page in W3C I am getting 27 errors - all within the script for the slide-show.
What should be my first step?

My URL is : http://www.mountainpassions.com

aka Robbie
07-10-2007, 11:15 AM
<script type="text/javascript" language="JavaScript" src="HideItInHere.js"></script>
:rolleyes:

Seriously a first step and fix is to place the code in a separate javascript file and then link to it.

jscheuer1
07-10-2007, 12:44 PM
1) Script Title: Ultimate Fade-In slide show

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm

3) Describe problem: I think the fade-in slide show is great and it does exactly what I need, however... when I validate the page in W3C I am getting 27 errors - all within the script for the slide-show.
What should be my first step?

My URL is : http://www.mountainpassions.com

First Step: Ignore w3c validation of HTML code if it isn't HTML code.


<script type="text/javascript" language="JavaScript" src="HideItInHere.js"></script>
:rolleyes:

Seriously a first step and fix is to place the code in a separate javascript file and then link to it.

This is a good idea, but make sure to follow Dynamic Drive's Usage guidelines that require, among other things, that the credit for the script remain on the page(s) that use it. And, skip the language attribute. With this script, used as an external script, you can do that like something like so:


<script type="text/javascript" src="dd_ufade.js">
/***********************************************
* Ultimate Fade-In Slideshow (v1.5): Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
</script>

Also, making a script external, although it is a rather simple matter, can be a little tricky for a novice. If you decide to go that route and have questions, let us know.

Joolsy_M
07-10-2007, 01:38 PM
Thanks John,

I have been trying to get the external .js file to work with no success so far.

I adjusted the code in accordance with your recommendations but still nothing.

Any suggestions?

jscheuer1
07-10-2007, 02:25 PM
With this script, it is safe to use the small portion (or portions, if using more than one show on a page) of it that go(es) in the body as instructed on the demo page without fear of any complaints from the validator. So, do that part just as before. For the main script (the part that normally would go in the head of your page), make sure that you are following these guidelines when converting it to an external .js file:




Use a text editor to save the script, call it 'file_name.js' where 'file_name' can be any valid file name of your choosing. Substitute the name of your external .js file for some.js in the below:


<script src="some.js" type="text/javascript"></script>

Common problems arise when:

1 ) The script file is not in the directory specified. In the above example it must be in the same directory as the page(s) that use it. Below, it can be in the scripts directory off of the root of a domain:


<script src="http://www.somedomain.com/scripts/some.js" type="text/javascript"></script>

2 ) Opening, closing and/or 'hiding' tags are left in the external file. This means that you must strip:
<script>
<!--and
//-->
</script>and any of their many variations from the beginning and end of the external file.

3 ) The external call (<script src="some.js" type="text/javascript"></script>) is not inserted into the page at the correct spot. The external call must be inserted at the same place on the page where the script was/would have been.

4 ) Paths to other files (if) used by the script are no longer valid due to its location. This is only a problem if the external script is kept in a different directory than the page it was working on when it was an internal script. To correct this, use absolute paths inside the script. Absolute path examples:


http://www.somedomain.com/images/button.gif

http://www.somedomain.com/~mysitename/index.html

5 ) Inappropriately combining two or more scripts into one external file. Usually external scripts can be combined if one knows enough about scripting to do so properly. Even then it is possible to overlook something.

A rule of thumb when testing is, if it won't work on the page, it won't work as an external file either.

One other thing, if this is a DD script or any script that requires the credit remain for legal use, include the credit in the on page call, ex:


<script src="some.js" type="text/javascript">
/***********************************************
* IFrame SSI script II- Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/
</script>

Make sure to retain all the 'decorations', as these include begin and end javascript comment delimiters without which the script won't function.

If it is still not working out for you, a link to your problem page would be the best way to determine the exact problem(s).

Joolsy_M
07-11-2007, 10:29 AM
Thank you very much John.

After a little bit of backtracking I recopied the original code and it worked. My code had somehow got another <script></script> in the middle of it which must have been the problem.
You can see the results at:
http://www.mountainpassions.com

Thanks again.

T0bster
11-25-2007, 09:58 AM
I have also attempted to place the code in a separate JavaScript file, however I must have done something wrong because the slide show is appearing in the wrong position on the page, and I'm getting some random code showing up where the slide show is meant to be:-

http://www.jokersfuncasinos.co.uk/dev/

In the header and I have...



<script src="slideshow.js" type="text/javascript">
/***********************************************
* Ultimate Fade-In Slideshow (v1.5): Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
</script>


And in the body I have...


<script type="text/javascript">
//new fadeshow(IMAGES_ARRAY_NAME, slideshow_width, slideshow_height, borderwidth, delay, pause (0=no, 1=yes), optionalRandomOrder)
new fadeshow(fadeimages, 380, 252, 0, 3000, 0, "R")
</script>


Please help!

Thanks,
Toby

jscheuer1
11-25-2007, 01:00 PM
the slide show is appearing in the wrong position on the page, and I'm getting some random code showing up where the slide show is meant to be

Looks fine to me. You might need to reload your browser and/or clear its cache to get rid of an earlier saved version. If you are still having a problem, which browser are you using?