Using query template's and javascript

bfischer at usgs.gov bfischer at usgs.gov
Mon Apr 24 11:39:43 PDT 2000


Mapserver users,

I am trying to use javascript, with a query header, footer, and template
files.  I am fairly new to javascript, but maybe other people have some
insights on what is happening.  What I am trying to do is sum polygons'
attributes, from the polygons that get returned by a query.  I am using a
query header, footer, and template to return the results to the browser
inside a HTML table.  Here is the part of the HTML files with the
JavaScript program.  I am using the program within the body of my HTML
file.  The problem is nothing happens.  The code is there when I view the
page source in Netscape.  One thing I did notice is mapserver adds this
between the header and template files.

<html>
<head>
<title>Blank page</title>
</head>
<body>
</body>
</html>

Is this whats messing up the javascript?

header file:
<table>

<script LANGUAGE="JavaScript">
<!-- This script sums the area and writes it to HTML

var tam=0.0 ;

tam=[wsareami] ;

query template

tam=tam+[AREA_SQ_MI] ;

document.write("<tr>\n") ;
document.write("<td width="25%">[MAJOR]</td>\n") ;
document.write("<td width="25%">[AREA_SQ_MI]</td>\n") ;
document.write("</tr>\n") ;


query footer

document.write("Total Area is: ") ;
document.write(tam) ;

//-->
</script>
</table>

Thanks,

Brian Fischer
bfischer at usgs.gov
USGS WRD
2280 Woodale Dr.
Mounds View, MN
(612) 783-3133





More information about the MapServer-users mailing list