如果在js中有几个相同名字的函数,即使参数不一样,但是默认会调用最后一个,如:
function CodeTableAddClick() {
var sUrl = "/Administration/CodeTableMaintenance/WayOfContactMaintenanceAdd.aspx";
<%
// 0024203: SIS 3.0 - CodeTable Maintenance - Modify page title to json object for multiple language of the dialog
// http://mantis.88db.com/view.php?id=24203
// modify by Robin 2011-08-02
%>
var oDialogTitle = '{"DisplayTitle":sTitle,"ControlTitle":"Way Of Contact Maintenance"}';
ShowIframe(sUrl, "36", "8.5", oDialogTitle);
}
function CodeTableAddClick(codeid, langcode) {
var sUrl = "/Administration/CodeTableMaintenance/WayOfContactMaintenanceAdd.aspx?Codeid=" + codeid + "&langcode=" + langcode;
<%
// 0024203: SIS 3.0 - CodeTable Maintenance - Modify page title to json object for multiple language of the dialog
// http://mantis.88db.com/view.php?id=24203
// modify by Robin 2011-08-02
%>
var oDialogTitle = '{"DisplayTitle":sTitle,"ControlTitle":"Way Of Contact Maintenance"}';
ShowIframe(sUrl, "36", "11", oDialogTitle);
return false;
}
当在调用CodeTableAddClick()函数时,默认会调用 function CodeTableAddClick(codeid, langcode)这个函数,因为这个函数写在后面,如这样调用:
<input id="btnAdds" type="button" value="Add" runat="server" class="add" οnclick="CodeTableAddClick()"
οnmοusemοve="MoveClass(this)" οnmοuseοut="ResetClass(this)" />
那么这样调用还是调用后面的那个函数,不过两个参数值都是undefined