繁体   English   中英

我有这个代码,我想从用户那里获取输入,然后将它作为 HTML 输入中的 .txt 文件保存到我的设备本地

[英]I have this code, I want to take the input from the user and then save it to my device locally as .txt file from HTML Input

这是我到目前为止的代码,其中不包含任何在本地保存输入的方法。

该代码的目的是将用户提出的问题作为输入,然后将其保存在本地 .txt 中,然后我解决问题并将答案亲自发送给他们。

此代码不适合在线使用。 这个要在本地使用!!

我该怎么做才能将输入保存在 .txt 文件中?

<html>
    <head>
        <title> CodeHelper - Python </title>
        <link rel="icon" href="Logo.png" type="image/x icon"></link>
    </head>
    <style>
        @font-face{
            font-family: SaltyOcean;
            src: url(SaltyOcean.woff);
        }
        * {
            text-align: center;
        }
        body{
            background-color: darkgray;
            background-image: url(BACK_1.jpg);
            background-repeat: no-repeat;
            background-attachment: fixed;
            background-size: cover;;
        }
        .main_heading {
            text-align: center;
            font-family: SaltyOcean;
            color: wheat;
            opacity: 1;
            margin-top: 10vh;
            font-size: 64px;
        }
        .main{
            background-color: rgba(169,169,169,0.3);
        }
        .URL_Input, .Next {
            font-size:1.3em;
            padding:5px 10px;
            font-family: SaltyOcean;
            }
        .URL_Input {
            border-radius:4px 0px 0px 4px;
            width:30em;
            text-align: left;
            border:2px solid #EEEEEE;
            background: #EEEEEE;
            outline:none;
        }
        .URL_Input:focus {
            border:2px solid #0485ff;
        }
        .Next {
            border-radius:0px 4px 4px 0px;
            border:2px solid #0485ff;
            background: #0485ff;
            color:white;
            box-align: centre;
        }
        .hr_bottom{
            color: wheat;
            margin-top: 10vh;
        }
        .created_by{
            font-family: SaltyOcean;
            font-size: 32px;
            color: wheat;
            text-align: left;
        }
    </style>
    <body>
        <img src="Logo.png"></img>
        <div class="main">
            <h1 class='main_heading'> Help With Code in Python ! </h1>
        </div>
        <form method="POST">
        <input type='text' class='URL_Input' placeholder="Enter the question/program to be asked here..."></input>
        <button class='Next' type="" onclick="">Send</button>
        </form>
        <hr class="hr_bottom"></hr>
        <h5 class='created_by'>Created by Bhavyadeep</h5>
    </body>
</html>

直到现在它都可以正常工作。 我只是想知道如何做到这一点。

出于安全原因,您不能或不应在 javascript 中本地使用文件,浏览器端 Javascript 无权写入用户 PC。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM