为什么这个按钮在IE中工作,而不是在Firefox? [英] Why this button works in IE but not in Firefox?

查看:160
本文介绍了为什么这个按钮在IE中工作,而不是在Firefox?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题,我不知道如何解决。这个按钮在IE中完美工作,但不在Firefox中。
这是HTML代码:

 < div class =divbutonSaveonclick =Save()style =float:right;> 
< span>保存< / span>
< / div>

这是Javascript代码:

  function Save(){
var poz ='1';
var rowCount = dataTable.rows.length;
var ala0 =; (var i = 1; i var c = document.getElementById(chk+ i);
if(c.checked == 1)
ala0 + = dataTable.rows [i] .cells [1] .innerText +^;
var ala = ala0.substring(0,ala0.length - 1);

$ .ajax({
url:'/ ProjectAdministrator / ProjectAdministratorProject / Partners',
data:{pozActivity:poz,listapart:ala},
dataType :$ J $,
类型:POST,
错误:function(){
alert(Error);
},
success:function数据){
window.close();
}
});
}

有什么建议吗?在此先感谢

解决方案

我建议如果你想要一个按钮,你应该使用 / code>,而不是 div 。这样你的标记就代表了它的意思,也可能有正常工作的副作用。


I have strange issue and I don't know how to fix. This button works perfectly in IE , but not in Firefox. This is the HTML code:

<div class="divbutonSave" onclick="Save()" style="float: right;">
<span>Save</span>
</div>

And this is the Javascript code:

 function Save() {
var poz = '1';
var rowCount = dataTable.rows.length;
var ala0 = "";
for (var i = 1; i < rowCount; i++) {
var c = document.getElementById("chk " + i);
if (c.checked == 1)
ala0 += dataTable.rows[i].cells[1].innerText + "^";
var ala = ala0.substring(0, ala0.length - 1);
}
$.ajax({
url: '/ProjectAdministrator/ProjectAdministratorProject/Partners',
data: { pozActivity: poz, listapart: ala },
dataType: "Json",
type: "POST",
error: function () {
alert("Error");
},
success: function (data) {
window.close();
}
});
} 

Any suggestions? Thanks in advance

解决方案

I'd suggest if you want a button, you should use a button in your markup, rather than a div. That way your markup will represent what it means, and it may have the side effect of working properly too.

这篇关于为什么这个按钮在IE中工作,而不是在Firefox?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆