Why is this piece of Javascript giving a parse error?
<script type="text/javascript"> var flashvars = { file: ’foo’, autostart: ’true’ };
</script>
Throws Uncaught SyntaxError: Unexpected to开发者_开发技巧ken ILLEGAL with the newest Google Chrome.
Probably because you don't use proper quotation marks. You use ’ instead of ' or ".
<script type="text/javascript">
var flashvars = {file: 'foo', autostart: true };
</script>
Two more things:
- Don't escape the quotes of the
typeattribute. truedoes not have to be in quotes.
You are using the wrong kind of apostroph. You write ’foo’ but it must be 'foo'
<script type="text/javascript">
var flashvars = { 'file': 'foo', 'autostart': true };
</script>
加载中,请稍侯......
精彩评论