如何动态更改<a> &#39;download&#39; field in HTML?

时间:2016-03-07 05:29:07

标签: javascript html

I have the following:

        AUTHOR<input type="text" name="author" id="authortxt"><br>
        FILENAME<input type="text" name="filename" id="filenametxt"><br>
        EMAIL<input type="text" name="email" id="email">
        <img id="saveicon" src="interface/SaveIcon0.png" onmouseover="this.src='./interface/SaveIcon1.png'" onmouseout="this.src='./interface/SaveIcon0.png'" />
        <img id="cancelicon" src="interface/CancelIcon0.png" onmouseover="this.src='./interface/CancelIcon1.png'" onmouseout="this.src='./interface/CancelIcon0.png'" />
        <a id="download" download="TestJSON-r.json">Download</a>

I need the filename of the download to be set by the 'FILENAME' field. What is the simplest way of doing this?

2 个答案:

答案 0 :(得分:0)

尝试在各个元素上使用.attr().val()来完成任务,

sudo rsync -azv --progress -e "ssh -i $HOME/<path_to>" \
  --rsync-path "rsync" \
  <source> \
  <target>

答案 1 :(得分:0)

如果你不使用jquery,你只需使用普通的Javascript。这是代码。

let setAdd l n = if (elem l n) then l else l ++ [n]
let setMember l i = l !! i