15 April 2006
This post may be outdated due to it was written on 2006. The links may be broken. The code may be not working anymore. Leave comments if needed.
大致上是我第一次用 JSAN. JSAN 的意思是 "CPAN".replace(/CP/, "JS") 它的目标是成为类似 CPAN 一样的 JS 库。 CPAN 是每个 Perl hacker 的骄傲。不过 JSAN 目前的东西不是很多。

我用的是 Form.Validator, 检验 form 输入的东西。不过 JSAN 这个模块的命令似乎在 Win32 下跑不起来。只好一个个去下。
http://www.openjsan.org/doc/c/cw/cwest/JSAN/0.10/
http://www.openjsan.org/doc/b/be/beppu/Form/Validator/0.33/index.html

下回来。目录的结果大致为:
JSAN.js
Form/Validator.js
Form/Validator/*
根据 http://www.openjsan.org/doc/b/be/beppu/Form/Validator/0.33/lib/Form/Validator.html 这里的说法写 HTML 文件。大致为:
<script src='/js/JSAN.js'></script>
<form name="stuff" ...
<script>
JSAN.use('Form.Validator');
JSAN.use('Form.Validator.Report.AlertAll');
fv = new Form.Validator(document.stuff);
fv.reporter('AlertAll'); // show a pop-up with all errors
fv.set('title', 'notBlank', "Title is required.");
fv.set('text', fv.makeValueMin(5), "Text must be 5 or greater.");
</script>

have fun.


blog comments powered by Disqus