我想要做的是获得与点击下面的提交按钮相同的结果。在JavaScript中获取'this'对象而不使用'this'这个词
<input id="submit_http:" class="add_submit" type="button" onclick="return dex.forms.form_ajax_submit(this,function(res) { alert('posting failed'); },function(res) { alert('posting success'); });" value="Next" name="submit_http:">
我试图做这样的:
$('.NextButton').click(function() {
dex.forms.form_ajax_submit(document.getElementsByName('submit_http:'),
function(res) {
alert('posting failed');
},
function(res) {
alert('posting success');
});
});
不过貌似document.getElementsByName没有返回相同的结果 的提交按钮“这个” 我怎样才能解决这个问题?
:使用
要么访问数组的第一个元素:
,或者使用已经推荐和更精确的功能'? – 2012-02-29 12:53:46
,因为我不能使用,因为它不会涉及到“提交”按钮,而是“NextButton” – DanR 2012-02-29 12:54:47
你用document.getElementsById检查它吗? – MCSI 2012-02-29 12:55:14