简体   繁体   English

如何在IPython对话框中编写HTML?

[英]How to write html inside IPython Dialog box?

How can I write html as html (not as HTML String) inside IPython Dialog? 如何在IPython对话框中将html编写为html(而不是HTML字符串)?

For example: I have a Ipython UI Extension that shows a Dialog box 例如:我有一个显示对话框的Ipython UI扩展

require(
    ["base/js/dialog"], 
    function(dialog) {
        dialog.modal({
            title: 'Hello world',
            body: ?? ,
            buttons: {
                'schedule': {}
            }
        });
    }
);

Now inside body of the dialog box, I want to show following HTML content. 现在,在对话框的内部,我想显示以下HTML内容。

    <label>Quick Schedule</label><br />

    <a class="btn btn-primary" onclick="schedule = '@reboot'; job_string();">Startup</a>
    <a class="btn btn-primary" onclick="schedule = '@hourly'; job_string();">Hourly</a>
    <a class="btn btn-primary" onclick="schedule = '@daily'; job_string();">Daily</a>
    <a class="btn btn-primary" onclick="schedule = '@weekly'; job_string();">Weekly</a>
    <a class="btn btn-primary" onclick="schedule = '@monthly'; job_string();">Monthly</a>
    <a class="btn btn-primary" onclick="schedule = '@yearly'; job_string();">Yearly</a><br /><br />

    <div class="row">
        <div class="col-md-2">Minute</div>
        <div class="col-md-2">Hour</div>
        <div class="col-md-2">Day</div>
        <div class="col-md-2">Month</div>
        <div class="col-md-2">Week</div>
    </div>

    <div class="row">
        <div class="col-md-2"><input type="text" class="form-control" id="job-minute" value="*" onclick="this.select();"/></div>
        <div class="col-md-2"><input type="text" class="form-control" id="job-hour" value="*" onclick="this.select();"/></div>
        <div class="col-md-2"><input type="text" class="form-control" id="job-day" value="*" onclick="this.select();"/></div>
        <div class="col-md-2"><input type="text" class="form-control" id="job-month" value="*" onclick="this.select();"/></div>
        <div class="col-md-2"><input type="text" class="form-control" id="job-week" value="*" onclick="this.select();"/></div>
        <div class="col-md-2"><a class="btn btn-primary" onclick="set_schedule();">Set</a></div>
    </div>

How can I show this HTML content? 如何显示此HTML内容? Lead here is really appreciated? 铅在这里真的很感激吗?

Refer answer in HTML String via jQuery append 通过jQuery引用HTML字符串中的答案

Tip: Write extensions for Jupyter Lab instead that supports writing Typescripts too. 提示:为Jupyter Lab编写扩展名也支持编写Typescript。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何把对话框里面的页面刷新? - how to put dialog box inside the page refresh? 如何在对话框内动态添加元素 - How to add elements dynamically inside a dialog box 如何在包含 JavaScript 或 Jquery 的 html 特殊实体的 SPAN 框内编写 - How to write inside a SPAN box with html special entity included with JavaScript or Jquery 怎么写 <div> HTML框中的代码,无需重新加载整个页面 - How to write <div> code inside a HTML box without reloading the entire page 如何使用javascript在DIV框内写入 - How to write inside a DIV box with javascript 在对话框按钮上的jquery对话框中显示html格式的文本 - show html formatted text inside jquery dialog box on dialog button click 除非直接在对话框函数中输入html,否则无法从jqgrid编辑表单中打开对话框 - Cannot get a dialog box to open from inside a jqgrid edit form unless the html directly entered into the dialog function 单击提交按钮时如何关闭jquery对话框(Submit按钮位于对话框内部) - How to close a jquery dialog box when a submit button is clicked(Submit button is residing inside the dialog box) 销毁位于对话框内的局部视图内的对话框? - Destroy the dialog box inside a partial view that sits inside the dialog box? 如何将文本框聚焦在自定义对话框中,以便光标在框内闪烁 - How to focus a textbox in a custom dialog, so that the cursor blinks inside the box
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM