469,315 Members | 1,597 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,315 developers. It's quick & easy.

Unterminated String Constant error

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
2 2942
iam_clint
1,208 Expert 1GB
This is very sloppy can you tell us what line your having the problem on?
May 24 '07 #2
mrhoo
428 256MB
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.

Similar topics

2 posts views Thread by polilop | last post: by
5 posts views Thread by ken s | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.