Greywacke Posted March 26, 2010 Share Posted March 26, 2010 hi everyone...i got an inpage script (a pair of script tags that follows, within the body tag.the snippet of code is as follows: <script language="JavaScript" type="text/javascript"><!-- window.onload = function () {var msg = "SQL DEBUGGING INFO:\nSELECT *...\", 1, 13);\n\n";if (msg.length>0) alert(msg); } // imagine these previous 3 lines as one line--></script> the string msg is rather extensive when alerting, however i need to alert the sql string output of the page to debug...can one do what i tried to do here, in one line? or does the commenting (old school habit) mess it up a tad... Link to comment Share on other sites More sharing options...
jeffman Posted March 26, 2010 Share Posted March 26, 2010 The code works fine. I tried it as one line with and without the old-school (and useless) comment tags. I was surprised to find that they were ignored, as intended, when the function was multiple lines, but ruin the function when it is all one line. I guess the interpreter is instructed to ignore the entire commented line, not simply the comment tag. But since the comments have been useless for many, many browser versions, you can safely remove them, and I told people the same thing 5 years ago. You can also remove the language attribute from your script tag. The type attribute is all you need. Link to comment Share on other sites More sharing options...
Greywacke Posted March 26, 2010 Author Share Posted March 26, 2010 okay... so javacript is the default language then... Link to comment Share on other sites More sharing options...
jeffman Posted March 26, 2010 Share Posted March 26, 2010 It's not so much that. If in fact there were a default, no additional information would be needed. But IE still supports Visual Basic, I believe, and the future may hold something else in store.The type attribute is simply more consistent with other Internet protocols, and the same attribute is used in style tags as well, which makes the whole system more consistent. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.