通过不同的选项,生成不同内容的1.htm文件,然后用showModelessDialog打开他。实际运行时发现,1.htm内容改变后,用showModelessDialog打开1.htm发现显示的内容并没有随着1.htm内容的改变而改变。
我的代码如下:可能比较难读,大家忍一下,非常简短的代码。
<?php
// 有点乱,这是要提交的两个单选项,用于确定生成不同内容的1.htm
echo "<form>";echo "<s";
echo "elect name=\"sel01\" style=\"width: 55\">\r\n\t\t\t";echo "\t\t <option value=\"";
echo "Op 1";
echo "\" ";echo "selected";echo ">";
echo "Op 1";
echo "</option>\r\n\t\t\t";echo "\t\t <option value=\"";
echo "Op 2";
echo "\" ";echo ">";
echo "Op 2";
echo "</option>\r\n\t\t\t";echo " \r\n\t\t </select>";echo "<input type=\"submit\" value=\"Submit\" name=\"submit\" />";
echo "</form>";function put_to_file($filename, $content)
{ if(!$handle = fopen($filename, 'w')) {
echo "Cannot open file ($filename)";
exit;
} // Write $somecontent to our opened file.
if (fwrite($handle, $content) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
} fclose($handle);
}if (isset( $sel01 )) //根据不同选项生成不同内容的1.htm
{
if( $sel01 == "Op 1" )
{
put_to_file("./1.htm", "Op 1");
}
else
{
put_to_file("./1.htm", "Op 2");
}
}
// 这里是脚本,意在用showModelessDialog显示1.htmecho "<script language='VBScript'>\r\nSub ShowErrDlg \r\n\tDim oDlg\r\n\tSet oDlg = window.showModelessDialog (\"./1.htm\", window, \"help:no;status:no;dialogWidth=370px;dialogHeight=500px\")\r\n\toDlg.document.execCommand(\"Refresh\")\r\nEnd Sub\r\n</script>";
echo "<input type=\"button\" value=\"Show File\" onClick=\"ShowErrDlg\">"
?>
我的代码如下:可能比较难读,大家忍一下,非常简短的代码。
<?php
// 有点乱,这是要提交的两个单选项,用于确定生成不同内容的1.htm
echo "<form>";echo "<s";
echo "elect name=\"sel01\" style=\"width: 55\">\r\n\t\t\t";echo "\t\t <option value=\"";
echo "Op 1";
echo "\" ";echo "selected";echo ">";
echo "Op 1";
echo "</option>\r\n\t\t\t";echo "\t\t <option value=\"";
echo "Op 2";
echo "\" ";echo ">";
echo "Op 2";
echo "</option>\r\n\t\t\t";echo " \r\n\t\t </select>";echo "<input type=\"submit\" value=\"Submit\" name=\"submit\" />";
echo "</form>";function put_to_file($filename, $content)
{ if(!$handle = fopen($filename, 'w')) {
echo "Cannot open file ($filename)";
exit;
} // Write $somecontent to our opened file.
if (fwrite($handle, $content) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
} fclose($handle);
}if (isset( $sel01 )) //根据不同选项生成不同内容的1.htm
{
if( $sel01 == "Op 1" )
{
put_to_file("./1.htm", "Op 1");
}
else
{
put_to_file("./1.htm", "Op 2");
}
}
// 这里是脚本,意在用showModelessDialog显示1.htmecho "<script language='VBScript'>\r\nSub ShowErrDlg \r\n\tDim oDlg\r\n\tSet oDlg = window.showModelessDialog (\"./1.htm\", window, \"help:no;status:no;dialogWidth=370px;dialogHeight=500px\")\r\n\toDlg.document.execCommand(\"Refresh\")\r\nEnd Sub\r\n</script>";
echo "<input type=\"button\" value=\"Show File\" onClick=\"ShowErrDlg\">"
?>
@header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// always modified
@header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
// HTTP/1.1
@header("Cache-Control: no-cache, must-revalidate");
// HTTP/1.0
@header("Pragma: no-cache");
不管用。