[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Error message "unterminated string literal"

Posted on 2006-06-02
6
Medium Priority
?
9,941 Views
Last Modified: 2012-05-05
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>

0
Comment
Question by:dereksheahan
  • 3
  • 2
6 Comments
 
LVL 25

Expert Comment

by:James Rodgers
ID: 16818399
post the source as viewed from teh browser
0
 

Author Comment

by:dereksheahan
ID: 16818410
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
 
LVL 25

Assisted Solution

by:James Rodgers
James Rodgers earned 400 total points
ID: 16818411
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:dereksheahan
ID: 16818450
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
 
LVL 15

Accepted Solution

by:
mshogren earned 1400 total points
ID: 16818638
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
 

Author Comment

by:dereksheahan
ID: 16818666
Thanks so much guys. Got that working!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question