Here is the second Spot the Error Competition. (If you missed the first, you can find it [COLOR=“#FF8C00”]here[/COLOR].)
See how many errors you can find in the quoted text below—a pretend forum post. These include grammatical and coding errors, and perhaps even others.
Since we’re in Olympic mode, we’ll award a free SitePoint ebook to the best three responses—ranked in Gold, Silver and Bronze positions.
Here are some ways to stand out from the crowd:
spot more errors than anyone else
offer outstanding explanations for why something is an error
list errors neatly, in point form.
Beware, though, as there’s a sting in the tail this time. If you flag something as an error that’s not one, you’ll be disqualified, so choose your errors carefully!
Remember that this is just for fun, and lively debate is welcome! We’ll leave the actual competition open for a day or two.
Good luck!
There seems to be problems with this code, but I can not see what. Id be greatful to whomever is able help with this. Im not much good with java.
The person who asked for help says they are not good with java but Java is a programming language not a scripting language used int his context
Line 1 Should read <!DOCTYPE html> it is missing the !
Line 2 Should read <html lang=“en”> not <html lang=“em”>
Line 5 should read <meta charset=“utf-8”> It was missing the hyphen in utf8 but also should read <meta http-equiv=“Content-Type” content=“text/html; charset=UTF-8” />
Line 7 Error is misspelled as Eror
Line 9 should have commas (,) between screen and projection and tv
Line 10 </head> is missing
Line 16 is missing the closing >
Line 17 should read <img href=“bird2.jpg” alt=“Bird in cage”> not <img href=“bird2.jpg alt=“Bird in cage”> It was missing the quote after the href
Line 20 is wrong. it should read <script type=“text/javascript” src=”/js/jquery.cycle.lite.min.js"></script> not <script type=“text/java” src=“/js/jquery.cycle.lite.min.js”></script> Javascript and Java are completely different. Java is an OOP language and JavaScript is an OO scripting language. Java must be compiled where Javascript does not
Line 21 should read <script type=“text/javascript” src=“https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js”></script> not <script type=“text/script” src=“https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js”></script>
Lines 20 and 21 should be placed in the head. The Javascript libraries are needed to make the animations work. If they are placed at the end of the document they are loaded after the HTML page is loaded
The original poster’s text has many errors. The sentence would make much more sense if written
like this:
It would make more grammatical sense to add a “they are” at
the end of the first sentence.
Needs an ’ between I and d ) - I’d
greatful is misspelled and should be grateful
Should not be whomever but whoever
Need to add the word “to” between able and help.
Another ’ is needed between I and m - I’m
I would not correct the error on the OP writing java as
it is a common mistake to new coders, so he might have written java
actually thinking it was java.
Code Section:
! missing from doctype so it should be <!DOCTYPE html>
lang=“em” should be changed to lang=“en” for english
meta tagshould be set as <meta http-equiv=“content-type” content=“text/html;charset=UTF-8”>
Error is spelled wrong in the title tag
media attribute should be media=“screen, projection, tv” and the href=“” should not contain a / at the beginninng of css or it will not call the right relative path
missing closing head tag </head>
HTML comment should start with two dashes like <!–
Image one should be like this instead: <img src=“bird1.jpg” alt=“Bird in flight”> (missing closing bracket, and needs to be src not href)
Image two should look like this: <img src=“bird2.jpg” alt=“Bird in cage”> (Should be src not href and missing closing ")
The script tag needs some work:
Could do 1 of 2 things to fix this
1. Change type to type=“text/javascript”
2. Since this is the HTML5 DOCTYPE the user could actually just leave out
the type attribute since HTML5 automatically uses text/javascript for
any <script> tag by default
Also need to remove the / before js in the src attribute
Same as above for second script tag
The scripts should be swapped since jquery.cycle.lite.min.js needs the jQuery loaded in order to run
I would personally move the scripts to either the head section or after the body tag, but don’t think
it is necessary to make the page function any better
It was the comment about disqualification for false positives that got me checking that one very carefully! (There was a grammatical one as well that I wasn’t sure about so I left it out)
It would probably help if the poster described what problems they were having, and what they are intending to achieve. Although it’s not that much of a point because it could be picked up from context / it’s obvious what it’s meant to do!
Code
Missing ! from Doctype
lang=“en” not lang=“em”
‘UTF-8’ not ‘utf8’ (although case insensitive, the hyphen should be there)
‘Eror’ should be ‘Error’ in <title>
Media attribute of link element must be a valid media query, so “screen, projection, tv”
Comment must start with <!–, not <!-
Comment cannot contain 2 consecutive hyphens even if it was a valid comment
Comment cannot end with a hyphen
<img> elements should have src attribute, not href
First <img> element is missing its closing >
Second <img> element is missing a quote
The alt attribute for both images should contain a text alternative for the images, not a description of them
The type attributes for both script tags should be “text/javascript”, or omitted entirely
The src attribute of the second script could generate a browser warning if this page is not on a secure site, as it refers to secure content
Arguably these scripts should be loaded in the document head
The scripts are loaded in the wrong order - jQuery should be loaded before its plugin
That’s everything I can see I think… bound to have missed something though!
An additional one that I wasn’t sure whether to put in, but I think I will:
Probably not the best idea to just load the latest 1.x.x version of jQuery - you should stick to a specific version in case future updates break things you are relying on
Actually I like you Ralph; I see you’ve possibly got at least another sneaky one or two hidden there in the code. That they haven’t spotted between them. Might involve them explaining why those are possible errors though.