我有一个ASP.net MVC2应用程序。我使用JQuery来更改所有表格行,以便我可以在任何行的任何位置单击以触发单击事件,从而触发所单击行中的链接。
这些表格是使用MVC的内置PartialView Ajax创建的。
以下是我的JQuery脚本。
在jquery-1.4.1.js的第1822行
我对Javascript并不是很精通,所以我陷入了困境。
编辑:在单击事件中,IE在我的window.open函数中遇到了空格问题。修复后,我现在可以看到单击事件实际上正在工作,但它进入了一个循环。它只会一直点击链接,直到出现栈空间不足的错误。
对此有什么想法吗?
这些表格是使用MVC的内置PartialView Ajax创建的。
以下是我的JQuery脚本。
<script type="text/javascript">
$(document).ready(function () {
$('table tr').live('click',function (event) {
$('#asplink', this).trigger('click');
})
.live('mouseenter',function (event) {
this.bgColor = 'lightblue';
})
.live('mouseleave', function (event) {
this.bgColor = 'white';
});
});
</script>
这是创建表格的局部视图代码的第一部分。
<% foreach (var item in Model.JobHeaderData)
{ %>
<tr>
<td>
<a id="asplink" href="http://localhost/sagstyring/EditJob.asp?JobDataID=<%: item.JobDataId %>&JobNumId=<%: item.JobNumID%>&JobNum=<%: item.JobNumID%>&DepId=1&User_Id=<%:ViewData["UserId"]%>" onclick="window.open(this.href,'Rediger sag <%: item.JobNumID %> ', 'status=0, toolbar=0, location=0, menubar=0, directories=0, resizeable=0, scrollbars=0, width=900, height=700'); return false;">Rediger</a>
</td>
在Firefox中,这个功能运行得很完美。但是,在IE中,当我点击一行时,JQuery会崩溃。
如果我在IE中调试页面,我会得到以下信息。
Out of stack space
在jquery-1.4.1.js的第1822行
// Trigger the event, it is assumed that "handle" is a function
var handle = jQuery.data( elem, "handle" );
if ( handle ) {
handle.apply( elem, data );
}
我对Javascript并不是很精通,所以我陷入了困境。
编辑:在单击事件中,IE在我的window.open函数中遇到了空格问题。修复后,我现在可以看到单击事件实际上正在工作,但它进入了一个循环。它只会一直点击链接,直到出现栈空间不足的错误。
对此有什么想法吗?