简体   繁体   English

如何在href下方的代码中建立链接? 我似乎无法使其成为可点击的链接

[英]How can I make the link in the code below an href? I can't seem to make it a clickable link

user = "1401";
document.write("User|"+CallSINIMethod("GetValue", ["UserField", "UserProfileFirstName", user])+"|<br><br>");


docs = CallSINIMethod("GetListValue", ["UserListProperty", "OrderedDocuments", user]);

i = 0;

while (i < docs.length) {

    document.write(CallSINIMethod("GetValue", ["DocumentProperty", "ProductName", docs[i]])+"|"+docs[i]+"|<br>");
    document.write("http://goodsamstorefront.com/goodsamstorefront/GetProof.aspx?id="+docs[i]+"<br>");
    document.write(CallSINIMethod("GetValue", ["VariableValue", "__DateUpdatedInCart", docs[i]])+"<br>");
    document.write(CallSINIMethod("GetValue", ["VariableValue", "__DocumentStatus", docs[i]])+"<br>");
    document.write(CallSINIMethod("GetValue", ["DocumentProperty", "EditingStatus", docs[i]])+"<br><br/>");
    i++;
}

To make the link clickable you should use the <a> tag. 要使链接可单击,您应该使用<a>标记。 For example: 例如:

<a href="https://google.com">https://google.com</a>

Is a link that both goes to Google and says " https://google.com " 是链接到Google并显示“ https://google.com ”的链接

You need to create an <a></a> tag like below: 您需要创建一个<a></a>标签,如下所示:

 document.write("http://goodsamstorefront.com/goodsamstorefront/GetProof.aspx?id=1<br>"); document.write("<a href='http://goodsamstorefront.com/goodsamstorefront/GetProof.aspx?id=1'>I am a Link</a><br>"); 

document.write as below should work 如下所示的document.write应该工作

document.write("<a href=http://goodsamstorefront.com/goodsamstorefront/GetProof.aspx?id="+docs[i]+"></a>");

or you can create a elements 或者您可以创建一个元素

var a = document.createElement('a');
a.setAttribute('href',link);
a.innerHTML = text;

and append but its a lengthy way way 并追加,但是这是一个漫长的方式

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

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