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
保留/保留替代Css的Javascript代码Cookie_Javascript_Html_Css_Cookies - Fatal编程技术网

保留/保留替代Css的Javascript代码Cookie

保留/保留替代Css的Javascript代码Cookie,javascript,html,css,cookies,Javascript,Html,Css,Cookies,能帮忙吗 我已经创建了一个网站,但需要知道如何让用户选择他们想要使用的css。 我想我需要用饼干,但我不是100%确定 这是我的索引页 <html> <head> <title>Internet Privacy</title> <link rel="stylesheet" type="text/css" href="styles/styles.css" title="Standard"> <link rel

能帮忙吗 我已经创建了一个网站,但需要知道如何让用户选择他们想要使用的css。 我想我需要用饼干,但我不是100%确定

这是我的索引页

<html>
<head>
    <title>Internet Privacy</title>
    <link rel="stylesheet" type="text/css" href="styles/styles.css" title="Standard">
    <link rel="alternate stylesheet" type="text/css" href="styles/AStyles.css" title="wacky" />
    <script type="text/javascript">
        function changeCSS(cssFile, cssLinkIndex) {
            var oldlink = document.getElementsByTagName("link").item(cssLinkIndex);

            var newlink = document.createElement("link");
            newlink.setAttribute("rel", "stylesheet");
            newlink.setAttribute("type", "text/css");
            newlink.setAttribute("href", cssFile);

            document.getElementsByTagName("head").item(0).replaceChild(newlink, oldlink);
        }
        document.cookie="CSS="
    </script>
</head>
<body>
    <div class="main_wrapper">
        <div class="header_wrapper">
        <!-- This the Logo and Banner Links-->
        <a href="index.php"><img id="logo" src="images/Logo.jpg" height="200" width="350"></a>
        <a href="http://www.wlv.ac.uk"><img id="banner" src="images/wlvLogo.gif" height="200" width="650">
        </div>
            <div class="menubar">
                <ul id="menu">
                    <!-- This is the Menubar that contains links to the various other pages-->
                    <li><a href="index.html">Home</a></li>
                    <li><a href="about.html">Privacy Laws</a></li>
                    <li><a href="procon.html">Pros and Cons</a></li>
                    <li><a href="wfa.html">Fights for Privacy</a></li>
                    <li><a href="aboutme.html">About Me</a></li>
                </ul>
            </div>
            <div class="content_wrapper">
            <!-- This is the Sidebar -->
                <div class="text">
                <h2>I have created this website for my first assignment.<br>This website is about how private the internet and how companies collect data, and how the data is used.</h2><br>
                <img id="indeximg" src="images/privacy.jpg" height="200" width="500">
                <br><p>Change Css Here <br> 
                <a href="#" onclick="changeCSS('styles/styles.css', 0);">Style 1</a> <br> 
                <a href="#" onclick="changeCSS('styles/AStyles.css', 0);">Style 2</a>
                </div>
            </div>
        <div id="footer"><!-- This is the footer and it will be at the bottom of the page --> 
        <br><p>The website was created by Vincent Priestley at The University of Wolverhampton 2015</p>
        </div>
    </div>
</body>

互联网隐私
函数更改CSS(cssFile、cssLinkIndex){
var oldlink=document.getElementsByTagName(“link”).item(cssLinkIndex);
var newlink=document.createElement(“链接”);
setAttribute(“rel”、“样式表”);
setAttribute(“类型”、“文本/css”);
setAttribute(“href”,cssFile);
document.getElementsByTagName(“head”).item(0).replaceChild(newlink,oldlink);
}
document.cookie=“CSS=”

  • 我为我的第一次任务创建了这个网站。
    这个网站是关于互联网的私密性、公司如何收集数据以及数据如何使用的。

    在此处更改Css

    网站由Vincent Priestley在伍尔弗汉普顿大学创建,2015

    如果有人能帮忙,我们将不胜感激

    先谢谢你
    维尼

    伙计,我不太确定你的要求是什么, 但是一般来说,如果你想要存储用户的信息,不应该在前端完成,我是说cookie,本地存储

    为了保存用户的信息,您需要数据库(甚至文件)和服务器端语言,比如php+MySQL、asp.mvc+sql


    使用cookie或任何其他前端技术都不好,不管怎样…

    啊,好吧,只是我必须只使用html,我想我必须在我的网站上为不同的用户创建一个单独的网页css@vincent,如果你只限于做html,我想你是对的,没有什么地方可以玩,勾选我的答案,祝你快乐,兄弟!