Query template + javascript?

Richard Greenwood richard.greenwood at GMAIL.COM
Mon Oct 16 12:50:07 PDT 2006


On 10/16/06, Xiaopeng Xiong <xpxiong at purdue.edu> wrote:
>
>
>
>
> I tried to add javascript to query templates. But it stops working by even
> declaring to use javascript.
>
> As in the following example:
>
>
>
> -----Header.html-------
>
> <html>
>
> <head></head>
>
> <body>
>
> <script language = "javascript">  //* after adding this statement, the
> result page becomes empty
>
> document.write("Just hello");  //* this does not work neither...
>
>
>
> ----Template.html-------
>
> <tr><td>[LABEL]</td><tr>
>
>
>
> ----Footer.html------
>
> </script>
>
> </body>
>
>
>
> It returns the query results correctly if the * statements are not inserted.
> But after adding the * statements, the result page becomes blank.
>
> Can anyone give a hint?
>
>
>
> Thanks,
>
> Xiaopeng
>
>
>
>


Move your closing </script> tag up to the line after document.write.
You hace HTML inside your javascript.

Also note that <script type="text/javascript"> is prefered to <script
language = "javascript">

Also check your javascript console for errors.

I use a lot of javascript in my templates and it works fine.

Rich



-- 
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com



More information about the MapServer-users mailing list