View Full Version : How to get gallery script to validate?

12-10-2008, 09:37 PM
1) Script Title: Advanced Gallery script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/agallery.htm

3) Describe problem: Will not validate at W3C. The validator will not accept the subject attribute.

Any way to get this to validate other than not using it?;)

I have used the script for some time, but someone recently pointed out to me that it causes my pages to fail validation at W3C.


12-11-2008, 02:12 AM
The problem is that subject is not a valid attribute which fails validation.

Better yet, replace it with title instead:

<div class="gallerycontent" subject="What is JavaScript?">
<div class="gallerycontent" subject="Java & JavaScript Differences">
<div class="gallerycontent" subject="What is DHTML?">

...and change highlighted into title:

for (i=0;i<totalDivs;i++){
var thesubject=partscollect[i].getAttribute("subject")

...and if you're serving your page as XHTML, then you should surround your script into CDATA islands, or better call it externally.

Hope that makes sense.