express.js render的模板里 配置如下
app.configure(function () {
app.set('view engine', 'html');
app.set('views', path.join(__dirname, 'views'));
app.register('.html', require('ejs'));
app.use(express.bodyParser({
uploadDir: config.upload_dir,
keepExtensions: true,
limit: 10000000,
defer: true //enable event }));
render的函数调用 res.render('topic/edit’, {tags: tags, topic_type:’话题’}); 想调用如下函数,显然需要load完成之后才能调用? 能否/应该如何在html模板中调用下列函数呢? 为什么用window.onload=dynamicview;调用无效呢?
function dynamicview()
{
if (!locals.topic_type ||locals.topic_type=='话题')
{
document.getElementById("needDiv").style.display="none";
document.getElementById("maxnumber").style.display="compact";
document.getElementById('type_0').checked = true;
}
else if(locals.topic_type=='发送')
{
..............
}