Javascript 刷新修改后的iframe
我有一个小应用程序。这将限制CMS的功能,更改文本、段落和图像 将要修改的页面位于iframe中,我会进行所有修改并保存这些新文本和图像,但不是在我“单击”提交时快速刷新页面,但我必须再次手动刷新页面以查看这些更改 如果不按F5刷新,我不知道如何查看这些更改 这是iframe:Javascript 刷新修改后的iframe,javascript,php,jquery,html,iframe,Javascript,Php,Jquery,Html,Iframe,我有一个小应用程序。这将限制CMS的功能,更改文本、段落和图像 将要修改的页面位于iframe中,我会进行所有修改并保存这些新文本和图像,但不是在我“单击”提交时快速刷新页面,但我必须再次手动刷新页面以查看这些更改 如果不按F5刷新,我不知道如何查看这些更改 这是iframe: <iframe id="probando" src="<?php echo $url; ?>" name="probando"></iframe> 尝试: document.ge
<iframe id="probando" src="<?php echo $url; ?>" name="probando"></iframe>
尝试:
document.getElementById('probando').contentWindow.location.reload(true)代码>
当需要重新加载iFrame时调用此命令。Modified?你是说修改了吗?哈哈,是的,抱歉修改了:冷嘲热讽。。。错误时有发生。如果我错了,请纠正我,但我实际上看不到您将内容放入iFrame的任何地方。你也不需要刷新,它应该自己出现。是的,但是如果我不刷新,我必须第一次刷新我看到的是旧文本。我尝试了,但没有找到:(你到底什么时候尝试刷新iFrame?当我单击提交时
<?php
$directorioInicial = "./"; //Especifica el directorio a leer
$rep = opendir($directorioInicial); //Abrimos el directorio
echo "<div class='button' id='mostrar'>Mostrar archivos</div>";
echo "<div id='acordeon' class='propiedadesCaja'>";
echo "<ul>";
while ($todosArchivos = readdir($rep)) {
if ($todosArchivos != '..' && $todosArchivos != '.' && $todosArchivos != '' && strpos($todosArchivos, '.html') && !is_dir($todosArchivos)) {
echo "<li class='listaPaginas' ><a class='listado' href=" . $todosArchivos . " target='probando'>" . $todosArchivos . "</a></li>";
// . $directorioInicial . "/"
}
}
closedir($rep);
clearstatcache();
echo "</ul>";
echo "</div>";
$url = "";
if (isset($_POST['textarea'])) {
$url = $_POST['textareaPagina'];
$salida = $_POST['textarea'];
$archivo = fopen($url, "w+");
fwrite($archivo, $salida);
fclose($archivo);
clearstatcache();
}
?>
$("#probando").contents().find("p,h1,h2,h3,h4,h5,h6,span,ul,li,a").on("click", function (e) {
swal({
title: "Nuevo texto",
text: "Escribe el texto deseado:",
type: "input",
showCancelButton: true,
closeOnConfirm: false,
animation: "slide-from-top",
inputPlaceholder: "Nuevo texto"},
function (inputValue) {
if (inputValue === false)
return false;
if (inputValue === "") {
swal.showInputError("¡No has escrito nada!");
return false
}
swal("¡Muy bien!", "Nuevo texto: " + inputValue, "success");
$(e.target).text(inputValue);
var contenido = $("#probando").contents().find('html').prop('outerHTML');
$("#contenido").text(contenido);
});
});