BootstrapDialog在我的Django项目中不起作用

时间:2019-05-31 15:15:40

标签: javascript django templates bootstrap-dialog

我正在使用BootstrapDialog来显示弹出窗口,但是它不起作用。我的代码是:

function monitor(user,ip,start_time,url){
   var div_username = 'User: ' +'<span class="text-info">'+user+'' + </span>';
   var div_ip = 'Server: ' +'<span class="text-info">' + ip + '</span>';
   var div_time = 'Start Time: ' + '<span class="text-info">'+start_time +'</span>';
   var title = div_username + div_ip + div_time;
   BootstrapDialog.show({
      size: BootstrapDialog.SIZE_WIDE,
      title: title,
      cssClass: 'large-dialog',
      type: BootstrapDialog.TYPE_DEFAULT,
      message:$('<iframe src="' + url +'" frameborder="0" scrolling="no" onload="this.height=780;this.width=1030;this.contentWindow.focus();" onmouseover="this.contentWindow.focus();"></iframe>'),
             draggable: true
   });
   return false;
}

单击按钮时将调用此函数:

<a class="btn btn-xs btn-success" onclick="monitor('{{element.user.username}}','{{element.server.ip}}','{{element.start_time}}','{% url 'app_name:monitor' element.id %}',)">Monitor</a>

0 个答案:

没有答案