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.

JavaScript Forum


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



Reply
Why isn't this piece of script XML compliant?
Old 06-18-2007, 03:21 PM Why isn't this piece of script XML compliant?
Experienced Talker

Posts: 44
Name: English Hentai Team
Trades: 0
Can anyone help me?

Code:
<div style="visibility: hidden; display: none;">
<!-- EasyBanner Pro code begin -->
<center>
<script language="JavaScript"> 
document.write('<s + cript language="JavaScript" src="http://www.sohentai.com/ads/work.php?n=259&size=1&j=1&code='+new Date().getTime()+'"></s>'); 
</script> 
<noscript>
<iframe vspace="0" frameborder="0" marginheight="0" marginwidth="0" height="78" src="http://www.sohentai.com/ads/work.php?n=259&size=1" hspace="0" scrolling="no" width="468"></iframe>
</noscript>
</center>
<!-- EasyBanner Pro code end -->
</div>
What is wrong here?

The following errors appeared (I understand the first one):

line 452, [user-supplied text]: error (1201): required attribute missing: script (missing "type") l

line 453, [user-supplied text]: error (1122): spurious punctuation inside markup: +

line 453, [user-supplied text]: error (303): parsing error: parse error, expecting `EQUALS'

line 453, [user-supplied text]: error (1121): malformed (unterminated?) tag: s

line 453, [user-supplied text]: error (1004): malformed entity reference: &size=1&j=1&code='+new
__________________

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

Last edited by ehentai; 06-18-2007 at 03:22 PM..
ehentai is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-18-2007, 03:56 PM Re: Why isn't this piece of script XML compliant?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
there is no attribute called "language"

it should be type="text/javascript"

the end script tag in your document.write should be </script> NOT </s>

use &amp; instead of &
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-18-2007, 06:16 PM Re: Why isn't this piece of script XML compliant?
Experienced Talker

Posts: 44
Name: English Hentai Team
Trades: 0
Thanks for replying.
Corected a few things.
Here how it looks now:

Code:
<!-- EasyBanner Pro code begin -->
<center>
<script type='text/javascript'> 
document.write('<s'+'cript language="JavaScript" src="http://www.sohentai.com/ads/work.php?n=259&ampsize=1&ampj=1&ampcode='+new Date().getTime()+'"></s'+'cript>'); 
</script> 
<NOSCRIPT>
<IFRAME SRC="http://www.sohentai.com/ads/work.php?n=259&ampsize=1" width=468 height=78 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling="no"></IFRAME>
</NOSCRIPT>
</center>
<!-- EasyBanner Pro code end -->
Still, the error appear:


line 452, [user-supplied text]: error (1123): GI begins with illegal character sequence: <s'+'cript
line 452, [user-supplied text]: error (1123): GI begins with illegal character sequence: </s'+'cript
line 455, [user-supplied text]: error (1121): malformed (unterminated?) tag: IFRAME
line 455, [user-supplied text]: error (1350): illegal character: 4
__________________

Please login or register to view this content. Registration is FREE
ehentai is offline
Reply With Quote
View Public Profile
 
Old 06-18-2007, 10:22 PM Re: Why isn't this piece of script XML compliant?
Ultra Talker

Posts: 256
Location: Auckland, New Zealand
Trades: 0
You didn't fix up everything chrishirst told you.

By the way, why are you aiming for XML compliance when it clearly shows you don't understand it. It's not just about satisfying a validator and although you're showing interest in achieving it, I don't see the determination to actually learn about it.

I don't know what Document Type you're using, what standards you're trying to achieve, but you're using tags and attributes that are deprecated.

document.write is no longer the method to alter documents, you must learn W3C DOM API and do it that way to achieve what you want and watch the attributes you're using, again they don't exist anymore and check the values and ensure they're quoted and correct and also the HTML name entities need the semi-colon to show it closed off.

You would probably not pick up all the things I outlined and I rather not write it out correctly for you either.

Cheers,

MC
__________________
#------------------------------signature---------------------------------------------------------------------------------#
Quote:
I am well recognised for what I don't do than what I do. Chores are just one of those things.
mastercomputers is offline
Reply With Quote
View Public Profile Visit mastercomputers's homepage!
 
Old 06-19-2007, 06:25 AM Re: Why isn't this piece of script XML compliant?
Experienced Talker

Posts: 44
Name: English Hentai Team
Trades: 0
This is for a blog. If the code isn't XML compliant the blog isn't published...

What about, telling me exactly what I should do?
I really don't have the time to learn it right now...

If you can't help, that's OK, but post like yours are a bit...
__________________

Please login or register to view this content. Registration is FREE
ehentai is offline
Reply With Quote
View Public Profile
 
Old 06-19-2007, 08:27 AM Re: Why isn't this piece of script XML compliant?
Ultra Talker

Posts: 256
Location: Auckland, New Zealand
Trades: 0
As far as I'm concerned I answered your question as to why it's not XML compliant.

Code:
line 452, [user-supplied text]: error (1123): GI begins with illegal character sequence: <s'+'cript
This means the General Identifier (GI) has illegal characters being used, what is really happening is the validator thinks <s'+c'ript is actually a markup tag, it does not see this as CDATA, you'll need to insert a <![CDATA[ comment ]]> in there so that it skips over this.

Code:
line 452, [user-supplied text]: error (1123): GI begins with illegal character sequence: </s'+'cript
Same as above.

Code:
line 455, [user-supplied text]: error (1121): malformed (unterminated?) tag: IFRAME
It's not finding the end tag for it, but it's uncertain when it says (unterminated?), this is probably a bigger mess than what I pointed out, there's a lot more that's wrong with just this tag and attributes.

Code:
line 455, [user-supplied text]: error (1350): illegal character: 4
Illegal characters mainly mean you're not using the correct HTML entities, ampersand (&) should be converted to &amp; If you count how many & characters you're using you should see 4 of them, just make them all &amp; with the semi-colon.

Will this fix all your problems, no but it's a start.

If you can fix the problems as stated, I may even be generous enough to provide the end all to this madness.

Cheers,

MC
__________________
#------------------------------signature---------------------------------------------------------------------------------#
Quote:
I am well recognised for what I don't do than what I do. Chores are just one of those things.

Last edited by mastercomputers; 06-19-2007 at 08:29 AM..
mastercomputers is offline
Reply With Quote
View Public Profile Visit mastercomputers's homepage!
 
Old 06-19-2007, 09:48 AM Re: Why isn't this piece of script XML compliant?
Experienced Talker

Posts: 44
Name: English Hentai Team
Trades: 0
Thanks.
I was using &amp instead of &amp;

Most has been resolved. Only the General Identifier (GI) problem stands...

To solve it I just have to make the document.write() argument like this?:

Code:
<![CDATA[ document.write('<s'+'cript language="JavaScript" src="http://www.sohentai.com/ads/work.php?n=259&ampsize=1&ampj=1&ampcode='+new Date().getTime()+'"></s'+'cript>'); ]]>
or like this?:

Code:
document.write( <![CDATA[
 '<s'+'cript language="JavaScript" src="http://www.sohentai.com/ads/work.php?n=259&ampsize=1&ampj=1&ampcode='+new Date().getTime()+'"></s'+'cript>' ]]> );
Or are both wrong?

And will the script work without problems?

Thanks...
__________________

Please login or register to view this content. Registration is FREE
ehentai is offline
Reply With Quote
View Public Profile
 
Old 06-19-2007, 10:00 AM Re: Why isn't this piece of script XML compliant?
Experienced Talker

Posts: 44
Name: English Hentai Team
Trades: 0
OK.. Found a solution that works.

<script type="text/javascript"><!-- script code here --></script>

The script is considered a comment by the XML validator (so no errors), but it is executed when the browser loads the page (don't know why....)

Anyone knows why this happen? I mean, if <!-- --> aren't comments in Javascript, then shouldn't a error occur, or something?
:/
__________________

Please login or register to view this content. Registration is FREE
ehentai is offline
Reply With Quote
View Public Profile
 
Old 06-19-2007, 03:00 PM Re: Why isn't this piece of script XML compliant?
willcode4beer's Avatar
Super Moderator

Posts: 1,533
Name: Paul Davis
Location: San Francisco
Trades: 1
The XML/HTML comment on one line is just a nice thing the script interpreters added to be extra nice. But, this isn't really valid.
Also, be aware, if the server has any preprocessing running (or added), you can expect to find those comments (and their content) stripped out of a page. So, this is a risky prospect.
You will probably be better off with something like:
HTML Code:
<script type="text/javascript">//<![CDATA[
   // code goes here
// ]]></script>
OTOH, using doc write to add a script tag instead of just adding a script tag is a bit weird.

Also, commenting that you don't have time to learn is pretty rude. Forums exist to help people learn, not to provide free services.
If you want to contract a service instead of learn, the best thread to do that is:
http://www.webmaster-talk.com/freela...gramming-jobs/
__________________

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

willcode4beer is offline
Reply With Quote
View Public Profile
 
Old 06-26-2007, 08:40 AM Re: Why isn't this piece of script XML compliant?
Experienced Talker

Posts: 44
Name: English Hentai Team
Trades: 0
Quote:
Originally Posted by willcode4beer View Post
The XML/HTML comment on one line is just a nice thing the script interpreters added to be extra nice. But, this isn't really valid.
Also, be aware, if the server has any preprocessing running (or added), you can expect to find those comments (and their content) stripped out of a page. So, this is a risky prospect.
You will probably be better off with something like:
HTML Code:
<script type="text/javascript">//<![CDATA[
   // code goes here
// ]]></script>
Thanks for the tips... I wil try it.

Quote:
Originally Posted by willcode4beer View Post
Also, commenting that you don't have time to learn is pretty rude. Forums exist to help people learn, not to provide free services.
Yeah... you're rght. But I was really in a hurry. I needed that right away. But I agree with you
__________________

Please login or register to view this content. Registration is FREE
ehentai is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Why isn't this piece of script XML compliant?
 

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.34393 seconds with 12 queries