I have two html pages as follows
main.html中
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="resources/css/ext-all.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="extjs4.0.7/ext-all-debug.js"></script>
<script type="text/javascript" src="extjs4.0.7/ext-all.js"></script>
</head>
<body>
<iframe src="child.html" width="50%" heght="50%"/>
</body>
</html>
我必须在我的child.html中使用'extjs4.0.7 / ext-all-debug.js'和'extjs4.0.7 / ext-all.js'来创建按钮,如下所示 child.html:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
<script>
parent.Ext.onReady(function(){
parent.Ext.Msg.alert('Status', 'Changes saved successfully.');
var container=parent.Ext.create('parent.Ext.Container', {
renderTo:window.parent.Ext.getBody(),
items : [
{
xtype: 'button',
text : 'My Button'
}
]
});
parent.toSource();
});
<%--alert("HELLO WORLD");--%>
<%--parent.Ext.Msg.alert('Status', 'Changes saved successfully.');--%>
</script>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
我必须使用从“child.html”中的“Main.html”加载的javascript文件,而不在child.html中加载它,即child.html不应包含导入javascript标记