Error message "unterminated string literal"

Hi All,
Here is the javascript error I'm getting when I check it in the Javascript Console in FireFox. Wonder if anyone has any ideas what might be the problem?
Error: unterminated string literal
Source File: http://www.reachateacher.ie/map/subfinderlive.php
Line: 57, Column: 19
Source Code:
output.innerHTML = "<form name=form1 method=post action=subfinder_load_db.php><table border=0>

Here's the full page if it helps:) Any help would be greatly appreciated.
Thanks,
D

<html>
<head>
<title>SubFinder</title>

<script src="http://maps.google.com/maps?file=api&v=1&key=ABQIAAAAz2q3fh2p6GN4ORUIygGqvRT5bLGvgptkBc4xmkyz-Pf0lFowFBT1pZ-8Ihhw1_l1nV_FuT_dZGHhNw " type="text/javascript"></script>

</head>
<body>
<p><strong>SubFinder</strong></p>

<div id="map" style="width: 800px; height: 600px"></div>


<script type="text/javascript">
//<![CDATA[

var baseIcon = new GIcon();
baseIcon.shadow = "http://www.google.com/mapfiles/marker.png";
baseIcon.iconSize = new GSize(20, 34);
baseIcon.shadowSize = new GSize(37, 34);
baseIcon.iconAnchor = new GPoint(9, 34);
baseIcon.infoWindowAnchor = new GPoint(9, 2);
baseIcon.infoShadowAnchor = new GPoint(18, 25);

// Creates a marker whose info window displays the given number
function createMarker(point, text, markerstyle)
{
var icon = new GIcon(baseIcon);
icon.image = "http://www.reachateacher.ie/map/img/marker" + markerstyle + ".png";
var marker = new GMarker(point, icon);
// Show this markers index in the info window when it is clicked
var html = text;
GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});
return marker;
};




var map = new GMap(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GScaleControl());
map.centerAndZoom(new GPoint(0, 0), 16);


<?php

include_once('../Connections/maplive.php');


$result = mysql_query("SELECT * FROM subfinder",$dbh);
if (!$result)
{
echo "no result";
}

while($row = mysql_fetch_array($result))
{
if ($row['marker'] == 'A') $marker_type = 'Active';
if ($row['marker'] == 'M') $marker_type = 'Museum';
if ($row['marker'] == 'S') $marker_type = 'Sunk';
if ($row['marker'] == 'E') $marker_type = 'Event';
$info_text = "<div id=\"infowindow\" style=\"white-space: nowrap;\"><b>" . $marker_type . "</b><br>" . $row['desc'] . "<br><br><a href=" . $row[url] . " target=_blank>Link</a></div>";
echo "var point = new GPoint(" . $row['lon'] . "," . $row['lat'] . ");\n";
echo "var marker = createMarker(point, '" . $info_text . "','" . $row['marker'] . "');\n";
echo "map.addOverlay(marker);\n";
echo "\n";
}

mysql_close($dbh);
?>

GEvent.addListener(map, 'click', function(overlay, point) {
if (overlay) {
//map.removeOverlay(overlay);
} else if (point) {

output.innerHTML = "<form name=form1 method=post action=subfinder_load_db.php><table border=0>
<tr><td>Lat:</td><td align=left><input name=new_lat type=text id=new_lat value=" + point.y + "></td><td rowspan=4><input name=new_marker type=radio value=A checked>Active<br><input name=new_marker type=radio value=M>Museum<br><input name=new_marker type=radio value=S>Sunk<br><input name=new_marker type=radio value=E>Event</td></tr>
<tr><td>Lon:</td><td align=left><input name=new_lon type=text id=new_lon value=" + point.x + "></td></tr>
<tr><td>Text:</td><td align=left><input name=new_desc type=text id=new_desc size=60></td></tr>
<tr><td>URL:</td><td align=left><input name=new_url type=text id=new_url size=60></td></tr>
<tr></td><td align=left><input type=submit name=Submit value=Submit></td></tr></table></form>";

if (map.getZoomLevel() >= zoomToLevel) {
map.centerAndZoom(point, zoomToLevel);
}
map.addOverlay(new GMarker(point));
}
}
);
//]]>
</script>

<div id="output"></div>

dereksheahanAsked:
Who is Participating?
 
mshogrenCommented:
Try this correction:

output.innerHTML = "<form name=form1 method=post action=subfinder_load_db.php><table border=0>"+
"<tr><td>Lat:</td><td align=left><input name=new_lat type=text id=new_lat value=" + point.y + "></td><td"+
"rowspan=4><input name=new_marker type=radio value=A checked>Active<br><input name=new_marker type=radio "+
"value=M>Museum<br><input name=new_marker type=radio value=S>Sunk<br><input name=new_marker type=radio value=E>Event</td></tr>"+
"<tr><td>Lon:</td><td align=left><input name=new_lon type=text id=new_lon value=" + point.x + "></td></tr>"+
"<tr><td>Text:</td><td align=left><input name=new_desc type=text id=new_desc size=60></td></tr>"+
"<tr><td>URL:</td><td align=left><input name=new_url type=text id=new_url size=60></td></tr>"+
"<tr></td><td align=left><input type=submit name=Submit value=Submit></td></tr></table></form>";
0
 
James RodgersWeb Applications DeveloperCommented:
post the source as viewed from teh browser
0
 
dereksheahanAuthor Commented:
Here you go, the page is http://www.reachateacher.ie/map/subfinderlive.php

<html>
<head>
<title>SubFinder</title>

<script src="http://maps.google.com/maps?file=api&v=1&key=ABQIAAAAz2q3fh2p6GN4ORUIygGqvRT5bLGvgptkBc4xmkyz-Pf0lFowFBT1pZ-8Ihhw1_l1nV_FuT_dZGHhNw " type="text/javascript"></script>

</head>
<body>
<p><strong>SubFinder</strong></p>

<div id="map" style="width: 800px; height: 600px"></div>


<script type="text/javascript">
//<![CDATA[

var baseIcon = new GIcon();
baseIcon.shadow = "http://www.google.com/mapfiles/marker.png";
baseIcon.iconSize = new GSize(20, 34);
baseIcon.shadowSize = new GSize(37, 34);
baseIcon.iconAnchor = new GPoint(9, 34);
baseIcon.infoWindowAnchor = new GPoint(9, 2);
baseIcon.infoShadowAnchor = new GPoint(18, 25);

// Creates a marker whose info window displays the given number
function createMarker(point, text, markerstyle)
{
var icon = new GIcon(baseIcon);
icon.image = "http://www.reachateacher.ie/map/img/marker" + markerstyle + ".png";
var marker = new GMarker(point, icon);
// Show this markers index in the info window when it is clicked
var html = text;
GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});
return marker;
};




var map = new GMap(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GScaleControl());
map.centerAndZoom(new GPoint(0, 0), 16);


 var point = new GPoint(100.111000,100.111000);
var marker = createMarker(point, '<div id="infowindow" style="white-space: nowrap;"><b></b><br>333<br><br><a href=www.beast.com target=_blank>Link</a></div>','1');
map.addOverlay(marker);


GEvent.addListener(map, 'click', function(overlay, point) {
if (overlay) {
//map.removeOverlay(overlay);
} else if (point) {

output.innerHTML = "<form name=form1 method=post action=subfinder_load_db.php><table border=0>
<tr><td>Lat:</td><td align=left><input name=new_lat type=text id=new_lat value=" + point.y + "></td><td rowspan=4><input name=new_marker type=radio value=A checked>Active<br><input name=new_marker type=radio value=M>Museum<br><input name=new_marker type=radio value=S>Sunk<br><input name=new_marker type=radio value=E>Event</td></tr>
<tr><td>Lon:</td><td align=left><input name=new_lon type=text id=new_lon value=" + point.x + "></td></tr>
<tr><td>Text:</td><td align=left><input name=new_desc type=text id=new_desc size=60></td></tr>
<tr><td>URL:</td><td align=left><input name=new_url type=text id=new_url size=60></td></tr>
<tr></td><td align=left><input type=submit name=Submit value=Submit></td></tr></table></form>";

if (map.getZoomLevel() >= zoomToLevel) {
map.centerAndZoom(point, zoomToLevel);
}
map.addOverlay(new GMarker(point));
}
}
);
//]]>

</script>

<div id="output"></div>

0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
James RodgersWeb Applications DeveloperCommented:
do this on one line
output.innerHTML = "<form name=form1 method=post action=subfinder_load_db.php><table border=0>
<tr><td>Lat:</td><td align=left><input name=new_lat type=text id=new_lat value=" + point.y + "></td><td rowspan=4><input name=new_marker type=radio value=A checked>Active<br><input name=new_marker type=radio value=M>Museum<br><input name=new_marker type=radio value=S>Sunk<br><input name=new_marker type=radio value=E>Event</td></tr>
<tr><td>Lon:</td><td align=left><input name=new_lon type=text id=new_lon value=" + point.x + "></td></tr>
<tr><td>Text:</td><td align=left><input name=new_desc type=text id=new_desc size=60></td></tr>
<tr><td>URL:</td><td align=left><input name=new_url type=text id=new_url size=60></td></tr>
<tr></td><td align=left><input type=submit name=Submit value=Submit></td></tr></table></form>";

or as
output.innerHTML = "<form name=form1 method=post action=subfinder_load_db.php><table border=0>"+
"<tr><td>Lat:</td><td align=left><input name=new_lat type=text id=new_lat value=" + point.y + "></td><td"+
"rowspan=4><input "name=new_marker"+ "type=radio value=A checked>Active<br><input name=new_marker type=radio"+
"value=M>Museum<br><input "name=new_marker "type=radio value=S>Sunk<br><input name=new_marker type=radio value=E>Event</td></tr>"+
"<tr><td>Lon:</td><td align=left><input name=new_lon type=text id=new_lon value=" + point.x + "></td></tr>"+
"<tr><td>Text:</td><td align=left><input name=new_desc type=text id=new_desc size=60></td></tr>"+
"<tr><td>URL:</td><td align=left><input name=new_url type=text id=new_url size=60></td></tr>"+
"<tr></td><td align=left><input type=submit name=Submit value=Submit></td></tr></table></form>";
0
 
dereksheahanAuthor Commented:
Hi,
When I try your second post above it gives me the error msg:
Error: missing ; before statement
Source File: http://www.reachateacher.ie/map/subfinderlive.php
Line: 59, Column: 19
Source Code:
"rowspan=4><input "name=new_marker"+ "type=radio value=A checked>Active<br><input name=new_marker type=radio"+
0
 
dereksheahanAuthor Commented:
Thanks so much guys. Got that working!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.