gameboyz Posted December 22, 2008 Share Posted December 22, 2008 Hi pls don't misunderstand as a html question. I'm reading the javascript tutorial when I came across this: in order to make the script "browser friendly" for older browsers, it's good practice to include the "<!--" and "//-->" right? I also read that the "//" is a javascript comment tag which is to prevent execution of the "-->" ..Then why isn't the "<!--" after the "//" too? And is it okay not to enter the "//" as it works fine (I experimented). Link to comment Share on other sites More sharing options...
Ingolme Posted December 22, 2008 Share Posted December 22, 2008 If you put // before <!-- it would appear as text in the browsers that display scripts, but anyways, I don't see a need to comment script. The only browsers that display script are very old. I don't think there's anybody who uses them anymore. Link to comment Share on other sites More sharing options...
gameboyz Posted December 23, 2008 Author Share Posted December 23, 2008 If you put // before <!-- it would appear as text in the browsers that display scripts, but anyways, I don't see a need to comment script. The only browsers that display script are very old. I don't think there's anybody who uses them anymore.Okay, but for browsers which are very old which can't support javascript, why is there a need for // before the -->? Since javascript is not supported, the --> won't be executed right? Link to comment Share on other sites More sharing options...
jeffman Posted December 23, 2008 Share Posted December 23, 2008 Okay, but for browsers which are very old which can't support javascript, why is there a need for // before the -->? Since javascript is not supported, the --> won't be executed right?Only the comment tags are for the older browsers. The // is for almost-modern browsers that DO read the javascript. Without the slashes, the script would try to execute the closing comment. Truly modern browsers seem to understand the closing comment tag without the slashes.But I'm with Ingolme. I don't mess with the comment tags anymore. No problems. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.