如果你想使用JavaScript從錨標記做回發,你可以做
document.forms[0].submit(); //This will post your form
OR
__doPostBack();
OR
如果你想知道哪些控制造成回發。
的JavaScript
function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase().indexOf("n etscape") > -1) {
theform = document.forms["Form1"];
}
else {
theform = document.Form1;
}
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument;
alert(theform.__EVENTARGUMENT.value);
theform.submit();
}
用以下ASPX代碼,使其工作
<input type="hidden" name="__EVENTTARGET" />
<input type="hidden" name="__EVENTARGUMENT" />
希望這是你在找什麼。
jQuery是一個JavaScript庫,不是JavaScript的替代品。 – Quentin 2012-02-03 09:16:21
[如何從客戶端JavaScript函數調用服務器方法背後的代碼可能的重複?](http://stackoverflow.com/questions/5828803/how-to-call-code-behind-server-method-from-a -client側JavaScript的函數) – Quentin 2012-02-03 09:16:58