My text editor is telling me I have a syntax error in my Javascript. It is somewhere in this line:
<script type="text/javascript"> if (!window.mstag) mstag = {loadTag : function(){},time : (new Date()).getTime()};</script>
Jslint tells me that I have an "Unexpected '<'." in Line 1, Character 1. So that, I'm guessing, means I have an error in the script type itself, which doesn't make much sense to me. I'm a newb, sorry if this is a super-basic question. Thanks in advance for any help you can give me.
-
2There is no syntax error. What editor tells you there is one?dfsq– dfsq2014年02月27日 19:51:09 +00:00Commented Feb 27, 2014 at 19:51
1 Answer 1
JSLint validates javascript. What you have here is a HTML <script>tag with javascript inside. You should only paste in the javascript to JSLint:
if (!window.mstag) mstag = {loadTag : function(){},time : (new Date()).getTime()};
My guess is that you've use <script type="text/javascript"> inside a .js file and your editor has no idea what is going on - is that correct?
3 Comments
.js file you should not use any <script> tags. They're only used when outputting HTML.