/    Sign up×
Community /Pin to ProfileBookmark

Is there a JavaScript Validator?

Whenever I try to validate a HTML source-coded page, the validator gives me errors in the script tag that are supid! 😮 😮

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@temp_user123Jul 10.2007 — The validator is not stupid... hmmm, hmmm, hmmm...

At any rate... My script tags never kick out in the HTML validator, so there is something wrong with yours. Show 'em.
Copy linkTweet thisAlerts:
@felgallJul 10.2007 — If you are validating XHTML then any JavaScript needs to be inside CDATA tags or it will be treated as HTML instead of data.
Copy linkTweet thisAlerts:
@____MaNiC_MoE____authorJul 10.2007 — 
The validator is not stupid... hmmm, hmmm, hmmm...

At any rate... My script tags never kick out in the HTML validator, so there is something wrong with yours. Show 'em.
[/QUOTE]


Whenever I validate a HTML page, the validation spots things inside the JavaScripting tag!!

Example :

[code=html]
<script type="text/javascript"> for (i = 1; i <= 6; i++) { document.write("<h" + i + ">This is header " + i) document.write("</h" + i + ">") } </script>
[/code]



It says that there are unclosed tags in the <h1> although, I have to do so in the script for the loop to work!

[code=html]
<!-- Introduction Script --> <script type="text/javascript"> <!-- var Nickname = prompt("Welcome to my website! nn Please type in your Name or Nickname :","") if (Nickname != null || "") {document.write("<div class=Navigation_h>Welcome " + Nickname + " to my website! :)</div>")} //--> </script>
[/code]


It says "</div> | Closed tag for an unopened element!!"
Copy linkTweet thisAlerts:
@Banana_AnandaJul 10.2007 — If you are validating, and using on-page script, it seems like there [i]is[/i] a reason to use some form of script commenting.

(How about using external scripts ? [I]nudge[/I])
Copy linkTweet thisAlerts:
@felgallJul 10.2007 — All closing HTML tags that are inside of JavaScript should be coded as </ instead of </ so that they are recognised as being within the javaScript and are not the closing script tag.
×

Success!

Help @____MaNiC_MoE____ spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...