对不起伙计们,有点错误地说,这是编辑
有一个简单的问题,如何将此jquery代码更改为javascript:
$("#gotoPage").click(function(){
var abr = $("#txtPageNumber").val();
paging_go_page_('cf_pages_form_name1',abr);
});
并输入:
<div class="gotoPage_div">
<input type="text" id="txtPageNumber" class="txtPageNumber" onkeyup="this.value = this.value.replace(/[^0-9\.]/g,'');check(this);" value="<cfoutput>#attributes.page#</cfoutput>" />
<span>Lütfen, sayfa numarası giriniz <cfoutput>1-#lastpage#</cfoutput></span>
</div>
<div class="gotoSubmit">
<input type="submit" id="gotoPage" class="gotoPage" value="Değistir" style="width:50px;" />
</div>
像这样:
function change_page {
var abr = document.getElementById('txtPageNumber').value;
document.change_page.action=paging_go_page_('cf_pages_form_name1',abr);
}
我创建了一个表单,我想改变它的动作:
<form method="post" name="change_page" action="change_page()">
<div class="gotoPage_div">
<input type="text" id="txtPageNumber" onblur="if (this.value=='') this.value = this.defaultValue" onfocus="if (this.value==this.defaultValue) this.value = ''" class="txtPageNumber" onkeyup="this.value = this.value.replace(/[^0-9\.]/g,'');check(this);" value="<cfoutput>#attributes.page#</cfoutput>" />
<span>Lütfen, sayfa numarası giriniz <cfoutput>1-#lastpage#</cfoutput></span>
</div>
<div class="gotoSubmit">
<input type="submit" id="gotoPage" class="gotoPage" value="Değistir" style="width:50px;" />
</div>
</form>
谢谢大家的帮助!
答案 0 :(得分:0)
var abr = document.getElementById('txtPageNumber').value;
paging_go_page_('cf_pages_form_name1',abr);
答案 1 :(得分:0)
这样的事情应该有效
var abr = document.getElementById("txtPageNumber").value;
paging_go_page_('cf_pages_form_name1',abr);
答案 2 :(得分:0)
var abr = document.getElementById('txtPageNumber').innerHTML;
paging_go_page_('cf_pages_form_name1',abr);
答案 3 :(得分:0)
override
onclick
的{{1}}事件。
element
答案 4 :(得分:0)
$("#gotoPage").click(function(){
var abr = $("#txtPageNumber").val();
paging_go_page_('cf_pages_form_name1',abr);
});
没有jQuery将是:
document.getElementById( 'gotoPage' ) // = > $("#gotoPage")
[ document.addEventListener ? "addEventListener" : "attachEvent" ] // now depends on browser type we choose proper method to bind event handler and invoke this
( "click" , function() {
paging_go_page( 'cf_pages_form_name1', document.getElementById( "txtPageNumber" ).value);
} , true);
答案 5 :(得分:0)
//if you want to change form's action document.change_page.action = "your action url here";