471,859 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,859 software developers and data experts.

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 3018
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
reply views Thread by YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.