剑道弹出窗口加载html内容

问题描述 投票:0回答:1

这是我的剑道弹出脚本,可以正常工作。但是我想对它做一点改动。

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <link rel="stylesheet" href="styles/kendo.common.min.css" />
    <link rel="stylesheet" href="styles/kendo.default.min.css" />
    <link rel="stylesheet" href="styles/kendo.default.mobile.min.css" />

    <script src="js/jquery.min.js"></script>


    <script src="js/kendo.all.min.js"></script>


</head>
<body>
<div id="example">
    <div id="dialog">
    </div>
    <span id="undo" style="display:none" class="k-button hide-on-narrow">Click here to open the dialog</span>
</div>
<script>
    $(document).ready(function () {
        var dialog = $('#dialog'),
            undo = $("#undo");

        undo.click(function () {
            dialog.data("kendoDialog").open();
            undo.fadeOut();
        });

        function onClose() {
            undo.fadeIn();
        }

        dialog.kendoDialog({
            width: "450px",
            title: "Software Update",
            closable: false,
            modal: false,
            content: "<p>A new version of <strong>Kendo UI</strong> is available. Would you like to download and install it now?<p>",
            actions: [
                { text: 'Skip this version' },
                { text: 'Remind me later' },
                { text: 'Install update', primary: true }
            ],
            close: onClose
        });
    });
</script>
<style>
    #example {
        min-height: 350px;
    }
</style>


</body>
</html>

[您可以在脚本中看到一部分内容,内容为:"<p>A new version of <strong>Kendo UI</strong> is available. Would you like to download and install it now?<p>",而不是在此处添加固定文本,我要加载名为Terms.html的HTML文件的内容。

感谢您的帮助。

javascript kendo-ui
1个回答
0
投票

您可以通过urlcontent执行此操作:

dialog.kendoDialog({
            width: "450px",
            title: "Software Update",
            closable: false,
            modal: false,
            content  : {
              url: "Terms.html"
            },
            actions: [
                { text: 'Skip this version' },
                { text: 'Remind me later' },
                { text: 'Install update', primary: true }
            ],
            close: onClose
        }); 
© www.soinside.com 2019 - 2024. All rights reserved.