項目使用的是ext框架,版本是ext4.2
出現的問題代碼如下:
1 renderer : function(value){ 2 var html = "<a href=\"javascript:void(0);\" onclick=\"editServer('"+value+"')\" style=\"text-decoration:underline;color:blue;\">編輯</a> "+ 3 "<a href=\"javascript:void(0);\" onclick=\"accountBalance('"+value+"')\" style=\"text-decoration:underline;color:blue;\">余額</a>"; 4 return html; 5 }
而下面已經定義了editServer方法
1 function editServer(value){ 2 Ext.create('Ext.window.Window', { 3 y : 50, 4 x : 150, 5 title : '編輯渠道', 6 modal : true, 7 width : 680, 8 height : 330 9 ...... 10 }
但是運行的時候卻一直報沒有定義:
ReferenceError: editServer is not defined
解決方法:
將方法改為:
window.editServer= function(value){
......
}
再次運行后成功
參考網址:http://bsdn.org/projects/dorado7/issue/dorado7-6800