简体   繁体   English

刷新后html页面中的元素状态可能没有变化?

[英]It's possible the element in html page's status don't change when I refreshed?

for example, I clicked a button, then the <body> add a element like a <p> (maybe more changes), now if I clicked F5, the page will back to the status which is no the <p> .例如,我点击了一个按钮,然后<body>添加了一个像<p>这样的元素(可能会有更多的变化),现在如果我点击 F5,页面将回到没有<p>

Is there a way to keep the <p> ?有没有办法保留<p>

sorry about that my english is poor.很抱歉我的英语很差。

You could use the Javascript LocalStorage API or use a statut code in the url like您可以使用 Javascript LocalStorage API 或在 url 中使用状态代码,例如

http://example.com/yourpage.html?code=1 http://example.com/yourpage.html?code=1

with php you can use this :使用 php 你可以使用这个:

    <?php
        $statut = $_GET['code'];
        if($statut === 1){
          $message = 'Your text here';
        }
        else{
          $message = 'another message';
        }
    ?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我可以在客户端更改页面的HTML状态代码吗? - Can I change the page's HTML status code on the client side? 如何更改HTML元素的文本并且不删除javascript中的子级? - How to change HTML element's text and don't remove children in javascript? 当另一个元素的高度发生变化时,GSAP Scrolltrigger 动画开始/结束位置不会更新 - GSAP Scrolltrigger animation start/end positions don't update when there is a change in another element's height 我可以更改 HTML 元素的类型吗? - Can I change an HTML element's type? 在 html/javascript 中刷新页面时,如何更改图像的位置? - How can i change the position of an image when page is refreshed in html/javascript? 刷新页面时,历史日志不会被删除,或者历史日志会将其值存储在电子表格中 - History log won't get deleted when page is refreshed OR history log will stored it's value in spreadsheet 是否可以仅在html页面中的一个元素上执行外部js? - It's possible to execute external js on only one element in html page? 添加相邻元素时调整/更改 HTML 元素的宽度 - Resize/Change HTML element's width when adjacent element added jQuery切换会更改元素的宽度吗? 我不要 - jQuery toggle changes element's width? I don't want it to 当我更新 context.provider 的值时,子组件不会改变颜色 - When I update my context.provider's value, the child components don't change color
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM