Solved

JavaScript tag not validating

Posted on 2009-04-14
7
340 Views
Last Modified: 2012-08-14
I had to add some code supplied by an ad network company and the code they gave me took my page from zero validation errors to over 30 validation errors. Looking at it the w3c validator wants to see amphersands in their HTML version however the code will not work if I do that which must be from the sever end.

However, when look at the code I see no reason why the validator should require the HTML version. Can anyone out there shed some light on this? The only other supposition I came up with is that perhaps query parameters are simply not legal where they are using them but my gut tells me this is an oversight of the validator and it should be fixed.

Does anyone know for sure what the reality of the situation is?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

  "//www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html....>

	<head>

		<title>Something</title>

	</head>

	<body....>

		....

		<script language="javascript" src="http://media.fastclick.net/w/get.media?sid=12345&m=6&tp=8&d=j&t=n"></script>

		<noscript>

			<a href="http://media.fastclick.net/w/click.here?sid=12345&m=6&c=1" target="_blank">

				<img src="http://media.fastclick.net/w/get.media?sid=12345&m=6&tp=8&d=s&c=1" width=300 height=250 border=1>

			</a>

		</noscript>

		....

	</body>

</html>

Open in new window

0
Comment
Question by:RegProctor
7 Comments
 
LVL 3

Expert Comment

by:QualitySoftwareDevelopment
ID: 24145366
Is it not just a question of which HTML version you set wether it works or not?
0
 
LVL 21

Expert Comment

by:naspinski
ID: 24145395
You are validating to XHTML 1.0 Strict, which, as it implies is very strict.  Any reason you choose to validate to this level?  Your website will be evaluated with the guidelines for ehichever version of html you tell it to validate to, you are picking one of the highest levels, so it will require more to get it to validate.
0
 
LVL 42

Accepted Solution

by:
David S. earned 500 total points
ID: 24145765
The protocol is missing from the URL in the doctype?

Anyway the other errors are because that code is not even valid HTML 4.01 Transitional.

Each of the "&" needs to be changed to "&amp;"

language="javascript"  should be type="text/javascript"

Quotes are required for the values of attributes.

The <img> tag is unclosed.

CSS should be used instead of the border attribute.

The <a> element should be in a <p> or <div>.
                <script type="text/javascript" src="http://media.fastclick.net/w/get.media?sid=12345&amp;m=6&amp;tp=8&amp;d=j&amp;t=n"></script>

                <noscript>

                        <p><a href="http://media.fastclick.net/w/click.here?sid=12345&amp;m=6&amp;c=1" target="_blank">

                                <img src="http://media.fastclick.net/w/get.media?sid=12345&amp;m=6&amp;tp=8&amp;d=s&amp;c=1" width="300" height="250" />

                        </a></p>

                </noscript>

Open in new window

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:RegProctor
ID: 24173104
Hello naspinski, yes, I always code in the highest level of strictness. I am a programmer and I am used to well formed coding.

You made a lot of points Kravimer, I'll go through them as best I can:

By dropping the http in the doc type it can be used for both http & https. You will have to be okay with a warning from the validator but it's a useful trick if you don't want browsers throwing errors because you have the wrong protocol in the doc type.

If you read the question, I was asking if <code>&amp;</code> was needed in the JavaScript tag because the browser was not translating that to a <code>&</code> so of course the code is going to show them as just ampersands.

Language, img etc. Oops! I copied the wrong code over. This was their original code, not the code changed for strict specs. - sorry.

In any case you helped me look at this again and I found an error before the JavaScript tag and that I guess was throwing off the browser from translating the <code>&amp;</code> since once I fixed the preceding error it validated just fine and their server picked it up the query string just fine.
0
 
LVL 1

Author Closing Comment

by:RegProctor
ID: 31570284
Not the exact answer but it was one of those times when you just need someone else to help you see things clearly, thanks.
0
 
LVL 42

Expert Comment

by:David S.
ID: 24173227
Which browsers have given you a security warning because of the URL in a doctype?
0
 
LVL 1

Author Comment

by:RegProctor
ID: 24174191
It was a long time ago that I solved that problem and I don't really remember much more than the problem in general. Sorry, I just don't have that detail in my mind anymore.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now