如何以弹出形式打开动态形成的超链接 [英] How to open dynamically formed hyperlink as Popup
本文介绍了如何以弹出形式打开动态形成的超链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用淘汰赛形成超链接.现在,我必须打开链接作为弹出窗口. 请在下面找到代码段
I am forming the hyperlink using knock out. Now i have to open the link as popup. Please find the code snippet below
<a data-bind="attr: { href:'/Home/TechnicianData?logId=' + $data.LoginId}">
More tests...
</a>
推荐答案
在这种情况下,我认为最简单的方法是将"click"事件绑定到函数.像这样
In that case, I believe the easiest way is binding the "click" event to a function. Like this
<a href="javascript:void(0);" data-bind="click: $root.myFunction">Link Content</a>
JS
function YourViewModel() {
var self = this;
//...
self.myFunction = function (data) {
window.open('/Home/TechnicianData?logId=' + data.LoginId);
};
};
这篇关于如何以弹出形式打开动态形成的超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文