[Zope] Zope and Javascript

Phillip Hutchings sitharus at gmail.com
Wed Dec 22 15:12:22 EST 2004


On Wed, 22 Dec 2004 13:07:22 -0700, Joe Goldthwaite
<joe at goldthwaites.com> wrote:
> I've run into a problem that spawned what is probably a stupid question.
> I'm probably doing something wrong here.
> 
> I've been using JavaScript to control some cookie functions.  I created a
> page template called cookies.js and then placed a link on the page that
> looks like this; '<script language="JavaScript" src="cookies.js"></script>'.
> This has worked well for months.  I was trying out a routine I found that
> uses Javascript to sort HTML tables on the browser side.  Following the same
> pattern, I created a page template called "sorttable.js" and pasted the
> sample code into it.  When I tried to save it, I got an invalid tag error on
> this line;
> 
>     for (ti=0;ti<tbls.length;ti++) {
> 
> Obviously it thinks the less than sign is the start of a tag.  I didn't run
> into this before because my cookie script doesn't have any less than or
> greater than signs.  Since java scripts are pretty integral to web
> development, I'm sure Zope must have some way of processing them.  I know I
> could put the script in an external file but that seems like it would be
> kind of kludgy.  There are lots of different object types available; python
> script, structured text, etc. but which one would you use to store a java
> script file?
> 
> Joe Goldthwaite

I'd just use a generic file and set the type to text/javascript or
text/plain. That should do it, as Zope shouldn't parse a
text/javascript file for tags.
-- 
Phillip Hutchings
http://www.sitharus.com/
sitharus at gmail.com / sitharus at sitharus.com


More information about the Zope mailing list