jimfog Posted November 21, 2011 Share Posted November 21, 2011 I have a problem with the way some links appear in google chrome. The site i am referring to is here:http://www.hellenicastrology.gr/ Go in the footer in the #sitemap. Why the bullets appear in blue? I have set, in css, these links, when visited to be white, the specific rule is found in sitemap.css. While in ff everything is ok, in chrome the bullets are displayed blue-the links are ok though, they are displayed in white. Why do you think that happens? Link to comment Share on other sites More sharing options...
Ingolme Posted November 21, 2011 Share Posted November 21, 2011 You have this all wrong. List items don't go inside links, the links go inside the list items. The same with the <h3> tags. Put them inside list items. You probably should fix some of the [validation errors] on your site. Link to comment Share on other sites More sharing options...
jimfog Posted November 22, 2011 Author Share Posted November 22, 2011 Many errors, i have to go by them one by one. One question is though, why so many javascript errors, and difficult to pinpoint exactly the root of the problem. Link to comment Share on other sites More sharing options...
jimfog Posted November 28, 2011 Author Share Posted November 28, 2011 Ι am having difficulty understanding why the validation tool output some js syntax as error. For example: The first error that appears is this:Line 45, Column 76: character ";" not allowed in attribute specification list… var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)Here is the whole code: function MM_preloadImages(){ //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0) { d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}} The semicolon in the for loop, at the above position is perfectly legitimate. Why that? Link to comment Share on other sites More sharing options...
dsonesuk Posted November 28, 2011 Share Posted November 28, 2011 the html validator is treating js as part of html, which you don't want! you have to use comment tags within the <script> tags to prevent the validator reading the javascript code. <script type="text/javascript"><!--//function MM_preloadImages(){ //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0) { d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}} //--></script> Link to comment Share on other sites More sharing options...
ShadowMage Posted November 28, 2011 Share Posted November 28, 2011 I prefer CDATA tags: <script type='text/javascript'>//<![CDATA[...//]]></script> Link to comment Share on other sites More sharing options...
dsonesuk Posted November 28, 2011 Share Posted November 28, 2011 OK <script type="text/javascript">/*<![CDATA[*//*---->*/function MM_preloadImages(){ //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0) { d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}}/*--*//*]]>*/</script> Link to comment Share on other sites More sharing options...
jimfog Posted November 29, 2011 Author Share Posted November 29, 2011 ooops . I forgot the html validator is ...only for html. Anyway, what is the difference between CDATA & comment tags. I suppose i will remove the tags after the validation. Link to comment Share on other sites More sharing options...
jimfog Posted November 29, 2011 Author Share Posted November 29, 2011 So, CDATA are used so no errors appear when the parser "reads" javascript code. So, the parser which parses XHTML documents is an XML parser, not an HTML one? Within the CDATA tags, the XML parser ignores the code and the JavaScript parser takes over control? Is this how it works? Link to comment Share on other sites More sharing options...
Synook Posted November 29, 2011 Share Posted November 29, 2011 The W3C HTML validator doesn't "validate" your Javascript — the CDATA markup declaration indicates that the contained text is just text, not HTML, and so it doesn't care anymore. Similar with the comment markup declaration (except that tells the parser the contents is a comment).P.S.: XHTML is a dialect of XML, and HTML is a dialect of SGML, so when it checks well-formedness it will use the relevant one. Link to comment Share on other sites More sharing options...
jimfog Posted November 30, 2011 Author Share Posted November 30, 2011 If CDATA declares the the content as text, then how the javascript parser "reads" it? I run the validator once more, The errors are very few now. Most of them are related with characters appearing in the URLs, which in turn are produced by Joomla.Why there characters appear as errors. I am considering leaving these errors as there are. What are the negative effects are going to be if i leave them as they are? Besides,I cannot do sth in the way joomla outputs URLs which in turn is related to its internal structure. Link to comment Share on other sites More sharing options...
dsonesuk Posted November 30, 2011 Share Posted November 30, 2011 Have you set the links to search engine friendly SEF in config? it will show error for the & characters in index.php?this=that&that=this, and ask you to change it to & instead, But! with SEF links it will show domain/this/that instead. In javscript to comment out code you would use //js code or /* js code */, so /*<![CDATA[*//*---->*/ /*--*//*]]>*/will tell the validator to ignore its content as html code, the javascript will ignore it as commenting out code and proceed to process the code. Link to comment Share on other sites More sharing options...
jimfog Posted November 30, 2011 Author Share Posted November 30, 2011 Regarding the SEF links i got it, i will do it cause i haven't so far.. Regarding the CDATA tags my q had another meaning. From the moment the code in CDATA tags is converted in text wouldn't be logical that javascript parser would be unable to read the specific code? Thanks and i hope i was more clear now. Link to comment Share on other sites More sharing options...
Ingolme Posted November 30, 2011 Share Posted November 30, 2011 Javascript is just text. The browser's Javascript parser parses any text data that's between the <script> tags. Link to comment Share on other sites More sharing options...
jimfog Posted November 30, 2011 Author Share Posted November 30, 2011 Now it is clear to me, thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.