문제점이 있습니다. 나는 javascript 함수로 동적 HTML 코드를 만들고 dojo 대화 내용을 넣으려고합니다. 내 자바 스크립트 함수는 다음과 같습니다dojo 대화 상자 동적 내용 2
function doPushButton(doc, id, action, title, imgRef, text, width, style) {
var tabIndex;
if(arguments.length > 8)
tabIndex = arguments[8];
var accessKey;
if(arguments.length > 9)
accessKey = arguments[9];
jt_docWrite('<div class="' + style + '" style="cursor: pointer' + (width > 0 ? ';width:' + width + 'px' : '') + '"', doc);
if(id != null)
jt_docWrite(' id="' + id + '"', doc);
if(tabIndex != null)
jt_docWrite(' tabindex="' + tabIndex + '"', doc);
if(accessKey != null)
jt_docWrite(' accesskey="' + accessKey + '"', doc);
jt_docWrite(' title="' + title + '" onclick="' + action + '">', doc);
if(imgRef != null)
jt_docWriteln('<img class="label_icon right" src="' + imgRef + '"/>', doc);
if(text != null)
jt_docWriteln('<span class="label">' + text + '</span>', doc);
jt_docWriteln('</div>', doc);
}
jt_docWrite 및 jt_docWriteln는 JS 기능입니다
:
function jt_docWrite() {
if (arguments.length == 1) {
document.write(arguments[0]);
}
if (arguments.length == 2) {
arguments[1].write(arguments[0]);
}
}
그리고 도장 dialog.create이 doPushButton() 함수 임 전화 :
require(["dojo/ready", "dojo/parser"], function(ready, parser){
ready(function(){
var dialog = dijit.byId("myDlg");
dojo.create('div', {
innerHTML: "Hello"
}, dialog.containerNode);
var div = dojo.create('div', {}, dialog.containerNode);
dojo.create('div', {
innerHTML: doPushButton(document, "yes", "doConfirm()", "", "../image/accept.gif", Res_yes_title, 0, "push_button")
}, div);
dialog.show();
});
I을 <script> doPushButton(document, "yes", "doConfirm()", "", "../image/accept.gif", Res_yes_title, 0, "push_button") </script>
과 같은 내 html 페이지에서 doPushButton() 함수를 사용하십시오. 제대로 작동하지만 이제는 dojo 대화 상자에 넣으 려합니다.이 함수는 "undefine"입니다. 누군가가 나에게 무엇이 잘못되었는지 도울 수 있습니까 ?? 고마워.
미로