我试图理解这段代码:
在display.php中:
<html>
...
<body>
<table>
<tr>
<td>
User info: <iframe id="SpControlFrame1" name="SpControlFrame1" src="javascript:'';"path_src="index.php?cmd=YYY" ></iframe>
</td>
</tr>
</table>
</body>
</html>
在另一个文件中,我有一个 switch 语句:
main.php
switch ("cmd") {
case ZZZ:
include("foo.php");
break;
case YYY:
include("blah.php")
break;
}
blah.php:
<?php
//some functions for processing
?>
<html>
<head>
...
</head>
<body>
<input type="text" size="12" name="username">
<input type="button" value="submit">
</body>
</html>
1)那么,有人可以解释一下这里发生了什么吗? iframe 嵌入在页面中,不会导致重新加载或类似的情况。
2) 我试图在另一个页面上复制此功能,但 iframe 始终为空(我已使用 IE 开发人员工具栏验证了这一点)
请您参考如下方法:
如果没有看到相关代码,我无法真正说出发生了什么。您的示例假定相关代码是服务器端的,并且当满足特定变量/条件时,iframe 将由 blah.php 创建或填充。
您必须确保在创建另一个 iframe 时调用相同的代码。也许您可以扩展相关代码?原始源和新源(不是 iframe,而是包含的文档)。