사용자가 버튼을 클릭 할 때 JS 함수를 호출하려고합니다. 그러나 onclick 이벤트는 해고되지 않습니다.javascript onclick이 버튼 클릭으로 실행되지 않음
오류가 실행 :
HTML
<td>
<button dojoType = "xwt.widget.form.TextButton" id = "pingButton" baseClass = "defaultButton" onclick = "onPing();">Ping
</button>
</td>
JS :
onPing : function() {
alert('works');
}
모든
다음function (/*Event*/ e){
// summary:
// Handler when the user activates the button portion.
if(this._onClick(e) === false){ // returning nothing is same as true
e.preventDefault(); // needed for checkbox
}else if(this.type == "submit" && !this.focusNode.form){ // see if a nonform widget needs to be signalled
for(var node=this.domNode; node.parentNode/*#5935*/; node=node.parentNode){
var widget=dijit.byNode(node);
if(widget && typeof widget._onSubmit == "function"){
widget._onSubmit(e);
break;
}
}
}
}
ReferenceError
arguments: Array[1]
get message: function() { [native code] }
get stack: function() { [native code] }
set message: function() { [native code] }
set stack: function() { [native code] }
type: "not_defined"
__proto__: Error
내 코드 개발자 도구는 나에게 다음과 같은 오류를 보여줍니다 sugges 무엇을해야 하는가?
코드가'type' 속성을 검사 할 때''에'type = "button"을 추가하십시오. –
아무 것도. 내 에 유형을 추가 한 후에도 동일한 오류가 발생합니다 – Kany
쓰레기 ... 'type = "submit"이라고 말 했어야했습니다. –