By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,786 Members | 1,131 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,786 IT Pros & Developers. It's quick & easy.

Unterminated String Constant error

P: 1
Hi i have following code,when i execute this code i got unterminated string constant error.any javascript guru can you look into this please.
raju

/* The link details */
var links = new Array ("link1", "link2", "link3");
var links_text = new Array ("Link 1", "Link 2", "Link 3");
var links_url = new Array ("link1.htm", "link2.htm","link3.htm");

/* Resolve the location */
var loc=String(this.location);
loc=loc.split("/");
loc=loc[loc.length-1].split(".");
loc=loc[loc.length-2];

/* Menu generating function */
function dyn_menu_gen()
{
for(var i=0; i<links.length; i++)
{
if(loc==links[i])
{
document.write('<table class="explorer_active"
onmouseover="this.className=\'explorer_active\';re turn true"
onmouseout="this.className=\'explorer_active\';ret urn true" onmousedown="this.className=\'explorer_active\';re turn true"
onclick="location.href=\'' + links_url[i] + '\'"><tr><td> <a href="' + links_url[i] + '" class="menu">'+ links_text[i] + '<b></b></a></td></tr></table>');
}
else
{

document.write('<table class="explorer" onmouseover="this.className=\'explorer_over\';retu rn true"
onmouseout="this.className=\'explorer\';return true"
onmousedown="this.className=\'explorer_down\';retu rn true"
onclick="location.href=\''+ links_url[i] + '\'">
<tr><td><a href="' + links_url[i] +'" class="menu">'+ links_text[i] + '</a></td></tr></table>);
}
document.write(<table cellspacing="0" cellpadding="0" bgcolor="#FFFFFF"><tr><td></td></tr></table>');
}
}
May 24 '07 #1
Share this Question
Share on Google+
2 Replies


iam_clint
Expert 100+
P: 1,208
This is very sloppy can you tell us what line your having the problem on?
May 24 '07 #2

100+
P: 428
document.write('<table class="explorer_active"
onmouseover="this.className=\'explorer_active\';re turn true"
etc...
All of your line breaks break your string

'<table class="explorer_active" '+
'onmouseover="this.className=\'explorer_active\';r eturn true" '+

' continue string...
May 24 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.