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

时间:2018-02-28 19:24:44

标签: javascript html

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++;
}

3 个答案:

答案 0 :(得分:0)

要使链接可以点击,您应该使用<a>标记。例如:

private void Start()
{
    StartCoroutine(this.loadVideoFromThisURL(videoUrl));
}

[SerializeField]
internal UnityEngine.Video.VideoPlayer myVideoPlayer;
string videoUrl ="http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4";
private IEnumerator loadVideoFromThisURL(string _url)
{
    UnityWebRequest _videoRequest = UnityWebRequest.Get (_url);

    yield return _videoRequest.SendWebRequest();

    if (_videoRequest.isDone == false || _videoRequest.error != null)
    {   Debug.Log ("Request = " + _videoRequest.error );}

    Debug.Log ("Video Done - " + _videoRequest.isDone);

    byte[] _videoBytes = _videoRequest.downloadHandler.data;

    string _pathToFile = Path.Combine (Application.persistentDataPath, "movie.mp4");
    File.WriteAllBytes (_pathToFile, _videoBytes);
    Debug.Log (_pathToFile);
    StartCoroutine(this.playThisURLInVideo (_pathToFile));
    yield return null;
}


private IEnumerator playThisURLInVideo(string _url)
{
    myVideoPlayer.source = UnityEngine.Video.VideoSource.Url;
    myVideoPlayer.url = _url;
    myVideoPlayer.Prepare ();

    while (myVideoPlayer.isPrepared == false)
    {   yield return null;}

    Debug.Log ("Video should play");
    myVideoPlayer.Play ();
}

这两个链接都是谷歌并说“https://google.com

答案 1 :(得分:0)

您需要创建一个<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>");

答案 2 :(得分:0)

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;

并附加但是它的方式很长