使用javascript上传图片后填写文本字段

时间:2017-01-06 12:40:18

标签: javascript html html5

我的表单中有一个上传按钮和一个图片网址文字字段,用户可以手动输入网址或按钮上传图片,如下所示: enter image description here

我试图在用户按钮上传时填写网址字段白图,但我的代码不起作用,我没有使用javascript的经验。

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name example.com www.example.com;
    return 301 https://$host$request_uri;
}
server {
    listen 443 ssl http2 default_server;
    listen [::]:443 ssl http2 default_server;
    server_name www.example.com;

    include snippets/ssl-example.com.conf;
    include snippets/ssl-params.conf;

    add_header Strict-Transport-Security "max-age=300; includeSubdomains; preload";

    return 301 https://www.example.com$request_uri;
}
server {
    listen 443 ssl http2 default_server;
    listen [::]:443 ssl http2 default_server;
    server_name example.com;

    root /var/www/html;
    index index.html index.htm index.nginx-debian.html;

    include snippets/ssl-example.com.conf;
    include snippets/ssl-params.conf;

    add_header Strict-Transport-Security "max-age=300; includeSubdomains; preload";

    location ~ /.well-known {
        allow all;
    }
    location / {
        try_files $uri $uri/ =404;
    }
}

1 个答案:

答案 0 :(得分:0)

你可以这样做

 onchange = 'document.getElementById("example-url-input").value=document.getElementById("upload-btn").value'