The line itself is perfectly valid javascript. The line before it, however, is most likely not. If your interpreter is expecting a closing brace }
or closing paren )
and it sees "var" instead, you will get the error message Unexpected token: var
.
Check the line before the error for any syntax errors.
edit: The line before has a closing script tag as a string. The browser will see this as a closing script tag, regardless of the fact that it is in a string, and break the rest of your script.
To fix the issue, simply split your string in the middle of the closing script tag. e.g.
document.write('<script src="'+ url + '" type="text/javascript" ></scr' + 'ipt>');
See this related question.