阅读背景:

我需要刷新页面来更新文本区域,即使我以与以前相同的方式设置文本

来源:互联网 
<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="/go.html?url=stylesheet.css">
        <title>ZET</title>
        <?php
        $text = file_get_contents("text.txt");
        file_put_contents("text.txt", $_POST["file"]);
        ?>
        <script type="text/javascript">
        window.onload = function () {
            document.getElementById("save").addEventListener("click", submit);

            function submit() {
                document.getElementById("submit").submit();
                setTimeout(function () {
                    document.getElementById("text").value = "<?php echo $text ?>"
                }, 1000);
            }
            loop();

            function loop() {
                document.getElementById("textpost").value = document.getElementById("text").value;
                setTimeout(loop, 50)
            }
            document.getElementById("text").value = "<?php echo $text ?>"
        }

        submit.onclick = function () {
            location.reload(true);
        }
        </script>
    </head>

    <body>
        <textarea id="text"></textarea>
        <div id="tools">
            <div id="save"></div>
            <form action="index.php" method=POST id="submit">
                <input id="textpost" type="text" name="file">
            </form>
        </div>
    </body>
</html>
<!DOCTYPE html>
<html>
    <head>
        <link



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: