我正在使用dust.js (在谷歌上搜索了很多关于缺乏良好文档的信息后)。最后,我能够创建一个超链接dynamically.Now,我想给动态生成的超链接提供onclick功能。
function createLink(){
// register the template loading method with dust now
var compiled = dust.compile("Hello <a href='#' id='linked'>{name}</a>!", "intro"
所以我想在中创建新的标签。
我的意思是:
<imagebutton src="cool.gif" onclick="alert('you clicked the image!')">
<!-- New tag (^) loads an image and lets it have an onclick event -->
我想知道如何在中做到这一点。
如果是这样的话,如何才能做到这一点?
我想为两个图像制作模式盒。模式框正在打开,但无法关闭。
...
// When the user clicks anywhere outside of the modal, close it
window.onclick = function (event) {
if (event.target == modal) {
lol.style.display = "none";
}
}
...
我是CSS的新手,我知道周围有更多这样的话题。但似乎没有一个是我的问题的解决方案。因此,在尝试了2个小时后,所有的隐藏,过渡,显示等,并与风险张贴副本在这里是我的问题。
如何使用CSS和Javascript流畅地显示此模式?
CSS
/* The Modal (background) */
.modalestate {
visibility: hidden; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
left: 25;
top: 15;