Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
How to stop validation errors because of Javascript.
Old 06-28-2007, 12:30 PM How to stop validation errors because of Javascript.
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
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
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
 
Register now for full access!
Old 06-28-2007, 01:42 PM Re: How to stop validation errors because of Javascript.
Riane's Avatar
Super Talker

Latest Blog Post:
Happy Birthday, Steve!
Posts: 147
Name: Jordan
Location: Chicago, IL
Trades: 0
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>
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

Riane is offline
Reply With Quote
View Public Profile Visit Riane's homepage!
 
Old 06-28-2007, 02:10 PM Re: How to stop validation errors because of Javascript.
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
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.
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 06-28-2007, 02:16 PM Re: How to stop validation errors because of Javascript.
Riane's Avatar
Super Talker

Latest Blog Post:
Happy Birthday, Steve!
Posts: 147
Name: Jordan
Location: Chicago, IL
Trades: 0
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.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE


Last edited by Riane; 06-28-2007 at 02:18 PM..
Riane is offline
Reply With Quote
View Public Profile Visit Riane's homepage!
 
Old 06-28-2007, 02:33 PM Re: How to stop validation errors because of Javascript.
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
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
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 06-28-2007, 02:40 PM Re: How to stop validation errors because of Javascript.
Riane's Avatar
Super Talker

Latest Blog Post:
Happy Birthday, Steve!
Posts: 147
Name: Jordan
Location: Chicago, IL
Trades: 0
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.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

Riane is offline
Reply With Quote
View Public Profile Visit Riane's homepage!
 
Old 06-28-2007, 02:46 PM Re: How to stop validation errors because of Javascript.
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
no im using a conditionla comment for a FF ad, so if they using IE it displays i using other it dont.
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 06-28-2007, 02:52 PM Re: How to stop validation errors because of Javascript.
Riane's Avatar
Super Talker

Latest Blog Post:
Happy Birthday, Steve!
Posts: 147
Name: Jordan
Location: Chicago, IL
Trades: 0
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.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

Riane is offline
Reply With Quote
View Public Profile Visit Riane's homepage!
 
Old 06-28-2007, 03:02 PM Re: How to stop validation errors because of Javascript.
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
Why does it matter? it works.

Moving on...
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 06-28-2007, 03:06 PM Re: How to stop validation errors because of Javascript.
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
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 !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 06-28-2007, 03:08 PM Re: How to stop validation errors because of Javascript.
Riane's Avatar
Super Talker

Latest Blog Post:
Happy Birthday, Steve!
Posts: 147
Name: Jordan
Location: Chicago, IL
Trades: 0
Quote:
Originally Posted by LadynRed View Post
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.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

Riane is offline
Reply With Quote
View Public Profile Visit Riane's homepage!
 
Old 06-28-2007, 03:52 PM Re: How to stop validation errors because of Javascript.
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
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
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 06-28-2007, 04:24 PM Re: How to stop validation errors because of Javascript.
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
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 !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 06-28-2007, 04:52 PM Re: How to stop validation errors because of Javascript.
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
ook... )0.o
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 06-28-2007, 04:53 PM Re: How to stop validation errors because of Javascript.
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
why is w3c not allowing the language atr in the script tag?..
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 06-28-2007, 09:00 PM Re: How to stop validation errors because of Javascript.
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
It allows it, but you need to ADD it to your <script> attributes.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 06-29-2007, 06:42 AM Re: How to stop validation errors because of Javascript.
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
well this is the thing.

i think its if i validate in transitional it casues error if i DONT have the lanaguage in the script tag.

but when i validate under strict it causes error when i DO have it in the script tag.

but the validation error about the language that you (LNR) pointed out, if i removed the lanagauge from the bit it was saying it didnt show when i revalidated and shows all the other tags saying theres no atr langauge.

im getting bit confused.

btw its validating as strict its valid without any language tag... ???

i dont know maybe someone can shed somelight on whats happening?

Thanks,
Dan.
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 06-29-2007, 03:20 PM Re: How to stop validation errors because of Javascript.
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Your home page is validating XHTML strict now. I'd stick with Strict anyway.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 06-29-2007, 05:21 PM Re: How to stop validation errors because of Javascript.
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
i will now. but has the langauge attr been emoved from strict then?
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Reply     « Reply to How to stop validation errors because of Javascript.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.92922 seconds with 12 queries