How to stop validation errors because of Javascript.
06-28-2007, 12:30 PM
|
How to stop validation errors because of Javascript.
|
Posts: 6,174
Name: Dan
Location: Swindon
|
hi,
i noticed when i validate, http://dansgalaxy.co.uk/ipme i get quite a few validation errors, all on javascript, how can i fix this?...
Thans
Dan
__________________
Personal UK Webhosting Get 25% of ANY shared package for life ~ Promo: webmaster-talk (only for members!)
|
|
|
|
06-28-2007, 01:42 PM
|
Re: How to stop validation errors because of Javascript.
|
Posts: 149
Name: Jordan
Location: Chicago, IL
|
You have to create a .js file, and then link to it using the script method. You can't have inline javascript when you're trying to validate with a specific doctype.
Code:
<script language="JavaScript" type="text/javascript">
<!--
var url = "http://dansgalaxy.co.uk/ipme";
var title = "Dansgalaxy IP Me!";
function makeLink(){
if(document.all)
window.external.AddFavorite(url,title)
}
// -->
</script>
<script language="Javascript" type="text/javascript">
<!-- Begin
jsver = "1.0";
// End -->
</script>
<script language="Javascript1.1" type="text/javascript">
<!-- Begin
jsver = "1.1";
// End -->
</script>
<script language="Javascript1.2" type="text/javascript">
<!-- Begin
jsver = "1.2";
// End -->
</script>
<script language="Javascript1.3" type="text/javascript">
<!-- Begin
jsver = "1.3";
// End -->
</script>
<script language="JavaScript1.4" type="text/javascript">
<!-- Begin
jsver = "1.4";
// End -->
</script>
Should be
Code:
<script type="text/javascript" src="ipme.js"></script>
|
|
|
|
06-28-2007, 02:10 PM
|
Re: How to stop validation errors because of Javascript.
|
Posts: 6,174
Name: Dan
Location: Swindon
|
This dont work.
I have a few php variables in the JS. which im guessing dont get parsed causeing things like t Add to Favs not work...
Dan.
__________________
Personal UK Webhosting Get 25% of ANY shared package for life ~ Promo: webmaster-talk (only for members!)
|
|
|
|
06-28-2007, 02:16 PM
|
Re: How to stop validation errors because of Javascript.
|
Posts: 149
Name: Jordan
Location: Chicago, IL
|
You don't need some crappy JS for a user to add the site to their bookmarks. Not only that but it doesn't work in Firefox anyway. So get rid of that crap.
Consider adding a social bookmarking tool instead. Most people use places like del.icio.us and other websites to handle their bookmarks. Not only that, but I don't think you really need that right now.
You need to focus more on the design, then some crappy javascript features that aren't even necessary.
http://validator.w3.org/check?verbos...o.uk%2Fipme%2F
Also, get rid of any inline styling (align=center). You can easily apply this using CSS. Just create a class, ".center" with text-align=center, then apply "class=center" to whatever you want centered.
You also don't seem to really know a lot about XHTML; I would just recommend going with an HTML 4.01 doctype instead of what you have right now.
Last edited by Riane : 06-28-2007 at 02:18 PM.
|
|
|
|
06-28-2007, 02:33 PM
|
Re: How to stop validation errors because of Javascript.
|
Posts: 6,174
Name: Dan
Location: Swindon
|
Ok, Can i ask why does some javascript have
<!-- Begin after the <script ... > tag and
// End --> at the end before the </script> tag
Are they needed?
casusing some probs with a conditonal comment on a google ad...
Thanks
Dan
__________________
Personal UK Webhosting Get 25% of ANY shared package for life ~ Promo: webmaster-talk (only for members!)
|
|
|
|
06-28-2007, 02:40 PM
|
Re: How to stop validation errors because of Javascript.
|
Posts: 149
Name: Jordan
Location: Chicago, IL
|
Get rid of this:
Code:
/***********************************************
* Animated Collapsible DIV- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/
</script>
That is just a commented line that you can add to the javascript file that it belongs to.
And you have </script> in there when it's not ending any script of any sort.
Also using <-- --> comments out HTML (not PHP). So why are you commenting out google ads, and why are the using hacks with it?
Just uncomment them, or remove them if you're not going to display them on your website.
|
|
|
|
06-28-2007, 02:46 PM
|
Re: How to stop validation errors because of Javascript.
|
Posts: 6,174
Name: Dan
Location: Swindon
|
no im using a conditionla comment for a FF ad, so if they using IE it displays i using other it dont. 
__________________
Personal UK Webhosting Get 25% of ANY shared package for life ~ Promo: webmaster-talk (only for members!)
|
|
|
|
06-28-2007, 02:52 PM
|
Re: How to stop validation errors because of Javascript.
|
Posts: 149
Name: Jordan
Location: Chicago, IL
|
Get rid of it. Be realistic right now.
You just created this, and you're not going to have that many people visiting it aside from you and other people that view this thread (or anywhere else you have this linked.)
When your site is popular enough that majority of your viewers are using IE, then add that.
Otherwise just get rid of that crap. You're not going to make any money on a site that's going to get barely any hits, so get rid of **** that you don't need right now.
Use one ad right now, and if your traffic increases, add another ad.
|
|
|
|
06-28-2007, 03:02 PM
|
Re: How to stop validation errors because of Javascript.
|
Posts: 6,174
Name: Dan
Location: Swindon
|
Why does it matter? it works.
Moving on...
__________________
Personal UK Webhosting Get 25% of ANY shared package for life ~ Promo: webmaster-talk (only for members!)
|
|
|
|
06-28-2007, 03:06 PM
|
Re: How to stop validation errors because of Javascript.
|
Posts: 6,572
Location: Tennessee
|
Now who's calling people's code crap ???
Dan, there are only 2 critical errors on your home page that the validator spits out: the javascript line referencing the animation js file;
Quote:
|
Line 4 column 66: there is no attribute "language"
|
Add the correct language attribute and it should stop choking on that one.
<br clear="all"> which is invalid - use a class in your CSS to clear the float, then you can use something like <br class="brclear">.
For inline scripts, you should wrap the code inside CDATA, like this:
Quote:
<script language="Javascript" type="text/javascript">
//<![CDATA[
/* Replacement calls. Please see readme.txt for more information. */
if(typeof sIFR == "function"){
sIFR.replaceElement("h3.sectionHdr", "fabian.swf", "#9f0028", null, null, "#000000", 5, 0, 5, 0, "textalign=center", null, "transparent");
};
//]]>
</script>
|
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
|
|
|
|
06-28-2007, 03:08 PM
|
Re: How to stop validation errors because of Javascript.
|
Posts: 149
Name: Jordan
Location: Chicago, IL
|
Quote:
Originally Posted by LadynRed
Now who's calling people's code crap ???
|
Actually LadynRed, you clearly didn't read what I write, if you're trying to imply that I called his code crap =)
Reference this from an earlier post:
Quote:
|
You don't need some crappy JS for a user to add the site to their bookmarks.
|
The other crap I used was actual in place of the google ads, and I used crap as a noun, not as an adjective. 
|
|
|
|
06-28-2007, 03:52 PM
|
Re: How to stop validation errors because of Javascript.
|
Posts: 6,174
Name: Dan
Location: Swindon
|
O ffs...
to LNR: wtf? :s
<script language="Javascript" type="text/javascript">
//<![CDATA[
/* Replacement calls. Please see readme.txt for more information. */
if(typeof sIFR == "function"){
sIFR.replaceElement("h3.sectionHdr", "fabian.swf", "#9f0028", null, null, "#000000", 5, 0, 5, 0, "textalign=center", null, "transparent");
};
//]]>
</script>
huh please explain... no JS scripter here
Dan
__________________
Personal UK Webhosting Get 25% of ANY shared package for life ~ Promo: webmaster-talk (only for members!)
|
|
|
|
06-28-2007, 04:24 PM
|
Re: How to stop validation errors because of Javascript.
|
Posts: 6,572
Location: Tennessee
|
Dan, that was just an example to show you how to use the CDATA code. You can ignore the scripting inside, that's from sIFR - it allows you to use flash fonts to replace normal text on a page - but w/o having to use images. 
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
|
|
|
|
06-28-2007, 04:52 PM
|
Re: How to stop validation errors because of Javascript.
|
Posts: 6,174
Name: Dan
Location: Swindon
|
ook... )0.o
__________________
Personal UK Webhosting Get 25% of ANY shared package for life ~ Promo: webmaster-talk (only for members!)
|
|
|
|
06-28-2007, 04:53 PM
|
Re: How to stop validation errors because of Javascript.
|
Posts: 6,174
Name: Dan
Location: Swindon
|
why is w3c not allowing the language atr in the script tag?..
__________________
Personal UK Webhosting Get 25% of ANY shared package for life ~ Promo: webmaster-talk (only for members!)
|
|
|
|
06-28-2007, 09:00 PM
|
Re: How to stop validation errors because of Javascript.
|
|
| |