PDA

View Full Version : w3c Validation


Psyclones
02-10-2006, 10:58 AM
I have trolled through my template on the hull directory in an effort to validate it.

Got 4 errors remaining. these are caused by this puppy.

{* Javascript for tracking link clicks *}
<script type="text/javascript">
var root = '{$smarty.const.DOC_ROOT}';
{literal}
var a = document.getElementsByTagName("a");
for(i=0; i<a.length; i++)if(a[i].id != '')
a[i].onclick = count_link;
function count_link(){
i = new Image();
i.src= root+'/cl.php?id='+this.id;
return true;
}
{/literal}
</script>

Is there an alternative for it. Without this code my page validates.
Any help on this wil be ace.


thanks.
Psyclones

Boby
02-10-2006, 06:27 PM
Hello Psyclones!

Try this:
Content visible to registered users only.


Content visible to registered users only.
This is caused by "<a.length", change it to "< a.length" (put a space between "<" and "a"). This will no more interpret "<a.length" as a HTML tag.
It's all about were you put the spaces :)
You still get a small warning, but that is not an error, it validates now as xhtml.

The script is good but not good written. It is fixed in ver3.0.1 but I am planning to change the script for ver3.0.2 and if possible get a server-side solution, no more javascript.

One more question, how are your templates validating the numeric ID's in links? Or did you removed that?
Just a note, the feature is also fixed in ver3.0.1 ;)

Boby

Psyclones
02-10-2006, 07:05 PM
Content visible to registered users only.

upgraded it as per sugesstions in safe area.

thanks for your as always informative answer boby