0
我在母版頁上的保存按鈕被點擊時需要運行的子頁面上有一個javascript函數。從母版頁按鈕運行javascript功能
ValidateCheckList = function() {
var ErrorCodeU1001 = "U1001";
var ErrorCodeU1002 = "U1002";
var ErrorCodeU1003 = "U1003";
var errors = [];
$('<%= errorsHiddenField.ClientID %>').val("0");
var fingerprintsTaken = $('<%= FingerprintsTakenYesNo.PluginSelector %>').YesNoPlugin(YesNoMethodsEnum.IsYes);
if (!fingerprintsTaken) {
errors.push(ErrorCodeU1001);
}
var dnaTaken = $('<%= DNATakenYesNo.PluginSelector %>').YesNoPlugin(YesNoMethodsEnum.IsYes);
if (!dnaTaken) {
errors.push(ErrorCodeU1002);
}
var photographTaken = $('<%= PhotographTakenYesNo.PluginSelector %>').YesNoPlugin(YesNoMethodsEnum.IsYes);
if (!photographTaken) {
errors.push(ErrorCodeU1003);
}
if (errors.length > 0) {
('<%= errorsHiddenField.ClientID %>').val(errors.length.toString());
$(document).PageUtilPlugin(PageUtilMethodsEnum.DisplayUserNotificationMessage, { messageType: "Warning", message: errors });
}
}
我曾嘗試 -
$(document).ready(function() {
document.getElementById("ctl00_ctl00_ContentPlaceHolder1_SaveButton").onclick = ValidateCheckList;
但這不起作用。
它還需要做回發。
誰能幫助?
感謝
您是否嘗試過的屬性'的ClientIDMode添加=「靜態」'你'SaveButton'並與jQuery訪問它,而不是'document.getElementById' – Mentoliptus 2012-07-18 09:29:12
可能的重複http://stackoverflow.com/questions/6760235/how-to-call-a-javascript-from-master-page – 2012-07-18 09:29:16