两个不同的HTML文件如何相互调用?

我在一个HTML文件(delete-window.html)中设计了一个可以弹出的窗口,在另一个HTML文件(delete-business.html)中想调用那个可以弹出的窗口,要如何调用。
代码:
1.

<delete-window><div class="ui basic modal" id="">
    <i class="close icon" onclick="$('.ui.basic.modal').modal('hide');"></i>
    <div class="header">        Are you sure to delete?
    </div></delete-window>

2.

<delete-business><script>function deleteBiz() {
    $('delete-window.ui.basic.modal').show();
}</script></delete-business>


长风秋雁
浏览 1170回答 1
1回答

梦里花落0921

这样调用,代码如下页面1<!DOCTYPE html><html>&nbsp; &nbsp; <head>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <meta charset="UTF-8" />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <title>父页面</title>&nbsp;</head><script>&nbsp;function callback(e){&nbsp;&nbsp; alert(e)}&nbsp;</script>&nbsp; <body>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;<iframe src="index3.html"></iframe>&nbsp; </body></html>页面2<!DOCTYPE html><html>&nbsp; &nbsp; <head>&nbsp; &nbsp; &nbsp; &nbsp; <meta charset="UTF-8" />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <title>子页面</title>&nbsp; &nbsp; </head>&nbsp; &nbsp; <script>function opentargetWin(){&nbsp;&nbsp; &nbsp; window.parent.callback('调用目标弹出窗口!');&nbsp;}&nbsp;&nbsp; &nbsp; </script>&nbsp; &nbsp; <body>&nbsp;&nbsp;<input type="button" value="打开窗口" onclick="opentargetWin()">&nbsp;&nbsp; &nbsp; </body>&nbsp; &nbsp;&nbsp;</html>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript