Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/391.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么';javascript函数是否在html参考中工作? 购物车 ClearAll();_Javascript_Html - Fatal编程技术网

为什么';javascript函数是否在html参考中工作? 购物车 ClearAll();

为什么';javascript函数是否在html参考中工作? 购物车 ClearAll();,javascript,html,Javascript,Html,我想注销,同时从js文件执行函数ClearAll。但是,我已获得注销,而没有清理js中的内容 当您发出HTTP重定向时,大多数客户端(包括所有主流浏览器)都会透明地遵循它 HTTP响应的主体(即包含JavaScript的HTML文档)仅由不自动遵循重定向的客户端使用 由于未呈现HTML文档,因此不会执行JavaScript 您可能应该使用一个click事件处理程序运行JS,该事件处理程序监听用户在上一页单击的按钮以启动注销。什么是标题('Location:index.html')做什么?这只是

我想注销,同时从js文件执行函数
ClearAll
。但是,我已获得注销,而没有清理js中的内容

当您发出HTTP重定向时,大多数客户端(包括所有主流浏览器)都会透明地遵循它

HTTP响应的主体(即包含JavaScript的HTML文档)仅由不自动遵循重定向的客户端使用

由于未呈现HTML文档,因此不会执行JavaScript



您可能应该使用一个
click
事件处理程序运行JS,该事件处理程序监听用户在上一页单击的按钮以启动注销。

什么是
标题('Location:index.html')做什么?这只是登录页面。
function ClearAll() {
    localStorage.clear();
    doShowAll();
}
<?php
    session_start();
    header('Location: index.html');
?>
<html>
    <head>
        <meta charset="UTF-8">
        <title>shopping cart</title>
        <script src="Storage.js"></script>
        <link rel="stylesheet" href="StorageStyle.css">
    </head>
    <body>
        <script>ClearAll();</script>
    </body>
</html>
<?php
    $_SESSION['loggued_on_user'] = NULL;
?>
header('Location: index.html');