[英]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++;
}
要使鏈接可單擊,您應該使用<a>
標記。 例如:
<a href="https://google.com">https://google.com</a>
是鏈接到Google並顯示“ https://google.com ”的鏈接
您需要創建一個<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應該工作
document.write("<a href=http://goodsamstorefront.com/goodsamstorefront/GetProof.aspx?id="+docs[i]+"></a>");
或者您可以創建一個元素
var a = document.createElement('a');
a.setAttribute('href',link);
a.innerHTML = text;
並追加,但是這是一個漫長的方式
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.