我如何使用包含日语字符的文件路径来进行href

时间:2017-01-10 10:13:07

标签: javascript html

我如何使用包含日语字符的文件路径来进行href

eCell.innerHTML = "<a href="C:\02_代理店買取数Test Allocation\Failed_test_Allocation_85_20170110144943.csv" download>Failed</a>"

显示'???'在acnchor标记的鼠标悬停时,在底部的UI浏览器状态中代替日文字符。

1 个答案:

答案 0 :(得分:1)

  1. 在您的示例中,您尚未转义双引号,因此javascript无效。
  2. 要获得更强大的URI编码,请考虑使用encodeURIComponent()
  3. &#13;
    &#13;
    eCell.innerHTML = "<a href="C:\02_代理店買取数Test Allocation\Failed_test_Allocation_85_20170110144943.csv" download>Failed</a>" //everything between second and third " is something which the broswer will try to interpret as an object or variable
        
    eCell.innerHTML = "<a href=\"C:\02_代理店買取数Test Allocation\Failed_test_Allocation_85_20170110144943.csv\" download>Failed</a>" //variable is a string
    &#13;
    &#13;
    &#13;