Tag: onclick

如何有效地使用onClick和EJS

我正在尝试显示基于onClick事件的模式窗口 这是我在做onClick的地方 <div class = "post-content"> <a onClick = "<%"show()"%>"> <h6><center> <%= imageData[0].title%></center> </h6> </a> <img src = "<%= imageData[o].associated_images[0].url%>"> <center> <%= imageData[0].short_description%> </center> </div> 这是模态窗口 <% if(number){%> <div class = "single-preview"> <h6><center> <%= imageData[0].title%></center> </h6> <center><img src="<%=imageData[0].associated_images[0].url%>"style="width:720px height:405px;"> </center> <center> <%= imageData[0].long_description%> </center> <button class = "close-button"> × </button> </div> <%}%> 这是我的js文件 router.get(name, function(req, […]

如何获得节点js中dynamic创build的button的button动作?

我是expressionjs(和节点js)的新手。 我正试图实现一个onclick监听器dynamic创build的button。 这是我的代码 Native.pug doctype html html head title="div dude" body div.main#main(style="height:300px;width:800px;border-style: solid;border-color: #ff0000 #0000ff;padding:10px") each prod in product_name // Created by krishna on 19/5/17. div.child1#child1(style="float:left;height:280px;width:30%;border-style: solid;border-color: #ff0000 #0000ff;margin:10px") p.greetings#people1 Hello World! p.id#id #{prod.id} p.name#name #{prod.name} p.price#price #{prod.price} button.send#send(onclick='senddata()') Add to Cart script(src='/javascripts/try.js') try.js function senddata() { document.getElementById("send").innerHTML = "YOU CLICKED ME!"; } index.js var […]

Pug`#{}`无法在`onclick`中加载variables

所以我使用JavaScript对象来呈现项目列表。 我的对象是这样的: { text: 'One', url: 'index.pug' }, { text: 'Two', url: 'Two.pug' }, { text: 'Three', url: 'Three.pug' } } 有趣的部分是帕格渲染他们。 我正在使用像这样的东西: div ul.horizontalScroll each item in params.apps li a(onclick="loadXMLDoc(#{item.url})") #{item.text} 我不明白为什么item.text呈现正确,但点击链接不pingfunction。 在铬检查员,我看到这个: <a onclick="loadXMLDoc(#)">One </a> 。 为什么这个参数不能像index.pug那样通过呢?