Javascript Illegal Token Error
Posted
by
Pete Herbert Penito
on Stack Overflow
See other posts from Stack Overflow
or by Pete Herbert Penito
Published on 2011-01-08T18:37:22Z
Indexed on
2011/01/08
18:53 UTC
Read the original article
Hit count: 242
Forgive me if this is a simple problem but I can't seem to find why this code:
function create_content(c)
{
var html = "<div id='header'>"+c+"</div>";
if(c == "links")
{
var ul = "<ul><li><a href='http://www.mylink.com'>My Link 1</a></li>
<li><a href='http://www.mylink2.co.uk'>My Link 2</a></li></ul>";
html = html + ul;
}
return(html);
}
Is giving me this error in Chrome (win):
Uncaught SyntaxError: Unexpected token ILLEGAL
On the line that starts with "var ul = "
Any advice would help thanks!
© Stack Overflow or respective owner