justsomeguy Posted December 16, 2011 Share Posted December 16, 2011 Its not required for the running of javascript, ITS required for passing html validation take This code validates: <!doctype html><html><head><title>test</title></head><body><script type="text/javascript">var thistext ="this and that";if(thistext == "this and that" && thistext.length==13){alert("whooppee")}else{alert("boooooooooooooooooooooooooooooooo")}</script></body></html> If the comments are required for validating as XHTML, then to me that's a reason not to use XHTML when HTML5 is an alternative. Link to comment Share on other sites More sharing options...
thescientist Posted December 16, 2011 Share Posted December 16, 2011 ideally, the best (practices) way is just put your code in an external javascript file. one of the benefits being no validation issues. Link to comment Share on other sites More sharing options...
dsonesuk Posted December 16, 2011 Share Posted December 16, 2011 Then you should have pointed that out before coming out with that statement, NOT everyone can use HTML5 yet, they still use XHTML, as they have not updated to HTML5 YET! to just come out with an example without identifying the user is able to use HTML5 is premature without gathering the facts first. Link to comment Share on other sites More sharing options...
dsonesuk Posted December 16, 2011 Share Posted December 16, 2011 ideally, the best (practices) way is just put your code in an external javascript file. one of the benefits being no validation issues. AS already pointed out by me. Link to comment Share on other sites More sharing options...
justsomeguy Posted December 16, 2011 Share Posted December 16, 2011 Then you should have pointed that out before coming out with that statement, NOT everyone can use HTML5 yet, they still use XHTML, as they have not updated to HTML5 YET! to just come out with an example without identifying the user is able to use HTML5 is premature without gathering the facts first.I realize the examples in this particular thread are questions about a page with an XHTML doctype, but you always include that in your code in any thread (like here, or here). Your examples assume that people are using XHTML, even when people post HTML examples. In fact, this validates also: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>test</title></head><body><script type="text/javascript">var thistext ="this and that";if(thistext == "this and that" && thistext.length==13){alert("whooppee")}else{alert("boooooooooooooooooooooooooooooooo")}</script></body></html> So it seems like the only reason it wouldn't validate is if you're using XHTML, so why do people use XHTML again? NOT everyone can use HTML5 yetNo, I'm pretty sure HTML5 is open to everyone. Why would someone be unable to use it, especially for new code? I don't mean any offense, by now you realize I just like arguing against XHTML right? Link to comment Share on other sites More sharing options...
dsonesuk Posted December 16, 2011 Share Posted December 16, 2011 Did you enjoy searching through all the post i've made LOL, a real petty waste of time, Yes i may have produced my coding in XHTML but! it is the html and the js code I was giving them, IT was clearly shown that I was using XHTML and therefore they could clearly see what docttype I was working to. The MOST important point was the HTML and JS code alone, I did not want OR expect them use my XHMTL doctype. So that was a real pointless exercise. Link to comment Share on other sites More sharing options...
dsonesuk Posted December 16, 2011 Share Posted December 16, 2011 So it seems like the only reason it wouldn't validate is if you're using XHTML, so why do people use XHTML again? READ the HTML5 introduction page, that will tell you especially with the last few lines being a good clue. Another is many CMS still use XHTML because of HTML5 infancy, and because browsers still do not fully support HTML5 features, and rather wait until they do. Link to comment Share on other sites More sharing options...
justsomeguy Posted December 16, 2011 Share Posted December 16, 2011 Did you enjoy searching through all the post i've madeNo. a real petty waste of timeI prefer to show evidence with my claims. So that was a real pointless exercise.I made my point. There was a much better argument you could have made for your case, but I'll leave that up to you. READ the HTML5 introduction pageIndeed. I see that it is an update to several things, including XHTML, I see that it includes several new features and provides advantages over older technologies. that will tell you especially with the last few lines being a good clue. Another is many CMS still use XHTML because of HTML5 infancy, and because browsers still do not fully support HTML5 features, and rather wait until they do.Everything that is supported in XHTML is also supported in HTML5. Browsers do not lack support for anything in HTML5 that you can also do in XHTML. Hence, no reason to use XHTML. I'm not suggesting that you always use every feature that the spec mentions. There's a discussion here on this topic from 3 years ago. Link to comment Share on other sites More sharing options...
Ingolme Posted December 17, 2011 Share Posted December 17, 2011 The only other thing I'd have to add is that, if you are using XHTML, this will work for validation: <script type="text/javascript">//<![CDATA[ ---// ]]></script> So would this: <script type="text/javascript">//<![CDATA[*&</>/\%-->-><-> ---/* -><!-->>>-->!!*//* ]]> */</script> But as you know, adding more characters doesn't really improve the functionality of the <![CDATA[ ]]> section. Link to comment Share on other sites More sharing options...
dsonesuk Posted December 17, 2011 Share Posted December 17, 2011 The only other thing I'd have to add is that, if you are using XHTML, this will work for validation: <script type="text/javascript">//<![CDATA[---// ]]></script> So would this: <script type="text/javascript"><script type="text/javascript">/*<![CDATA[*//*Some W3shools FORUM MODS like to state the obvious---->*/---/*--*//*]]>*/</script> But as you know, adding more characters doesn't really improve the functionality of the <![CDATA[ ]]> section. Link to comment Share on other sites More sharing options...
thescientist Posted December 17, 2011 Share Posted December 17, 2011 uhhh... maybe to time to lock this one, eh? Link to comment Share on other sites More sharing options...
amitamberker Posted December 22, 2011 Author Share Posted December 22, 2011 uhhh... maybe to time to lock this one, eh? Hi thescientist, I guess dsonesuk and justsomeguy were discussing with each other. You should have allowed them to discuss further. But anyways... Link to comment Share on other sites More sharing options...
amitamberker Posted December 22, 2011 Author Share Posted December 22, 2011 Hi dsonesuk,How are you doing mate? I was out of station for a while. Hence I got disappeared. You know what mate? They said, there were many mistakes in the page which I had sent them. They said, the quality of the code was not as per their hopes. I am not sure if they were referring about JavaScript Code or DIVs / CSS code. I have replied to their email and waiting for response. Link to comment Share on other sites More sharing options...
thescientist Posted December 22, 2011 Share Posted December 22, 2011 Hi thescientist, I guess dsonesuk and justsomeguy were discussing with each other. You should have allowed them to discuss further. But anyways...well, in all fairness the discussion was devolving into the relative merits about which kind of commenting to use, and these kinds of "discussions" have been done in the past. Just saying we've been there before, and it never really "solved" anything per se. Some people use one way, some people use another way. I think by now we can say to each his own and move onto answering questions. Link to comment Share on other sites More sharing options...
thescientist Posted December 22, 2011 Share Posted December 22, 2011 Hi dsonesuk, How are you doing mate? I was out of station for a while. Hence I got disappeared. You know what mate? They said, there were many mistakes in the page which I had sent them. They said, the quality of the code was not as per their hopes. I am not sure if they were referring about JavaScript Code or DIVs / CSS code. I have replied to their email and waiting for response. what's the full code? What were there criteria? Did you have proper formatting and indentation? Everything validated? No errors? All external js/css? Professional level code shows a good sense of best practices, skillful application of the language(s), organization, good naming conventions, "no" globals, clean, valid, and semantic markup, neat CSS, (ideally) sprites for all static images. Chrome, Safari, and Firefox (probably Opera too) both have support for optimization and efficiency tests to run on your pages as well. Link to comment Share on other sites More sharing options...
amitamberker Posted December 24, 2011 Author Share Posted December 24, 2011 Hi thescientist,Will revert back to you soon. Tonight I have to travel. Link to comment Share on other sites More sharing options...
Krewe Posted January 15, 2012 Share Posted January 15, 2012 I don't know Javascript yet Creative so I can't help you. I have told you this on many occasions. Sorry. Link to comment Share on other sites More sharing options...
amitamberker Posted January 21, 2012 Author Share Posted January 21, 2012 I don't know Javascript yet Creative so I can't help you. I have told you this on many occasions. Sorry. Hi Krewe, I know Mate... I know! I remember you telling me this on many occasions. By the way I did not ask you anything about JavaScript in this thread So, you need to have to feel sorry mate. But however, I must confess that all the members have helped me a lot and SPECIFICALLY I am very thankful to dsonesuk! Link to comment Share on other sites More sharing options...
amitamberker Posted January 21, 2012 Author Share Posted January 21, 2012 Hello Everyone,They have found my mistakes in DIVs and CSS. They did not point-out any typos from JavaScript. They are OKAY with the JavaScript segment. Please keep an eye on:- http://w3schools.invisionzone.com/index.php?showtopic=41024&st=20Thank you everyone. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.