javascript严重错误script1006:预期')'用于asp.net中msgBody内的href

时间:2017-06-19 19:50:11

标签: javascript asp.net

我在尝试以下代码时遇到错误 -

Dim email As String = outPutParameter2.Value.ToString()
        If email <> String.Empty Then
            Dim url As String = "mailto:" + email
            Dim subject As String
            Dim msgBody As String
            Dim ProjLink As String = "Click on the <a href='http://abc.gov/Facts/ProjectDetails.aspx?project_pk=" + strProjectid + "'>Link</a>"
            subject = "?subject=Returned Facts Review For Project Number " + strProjNo
            msgBody = "&body=The Facts review has been returned. To check click " + ProjLink
            url = url + subject + msgBody
            ClientScript.RegisterStartupScript(Me.GetType(), "OpenWin", "<script>openNewWin('" & url & "');</script>")
        End If

所以我尝试使用像 -

这样的转义字符
Dim ProjLink As String = "<a href=\'http://abc.gov/Facts/ProjectDetails.aspx?project_pk=" + strProjectid + "\'>Link</a>"

然后整个链接显示在电子邮件中,但我希望它显示为仅与隐藏的实际路径相关联的单词。

有人可以帮忙吗?

由于

1 个答案:

答案 0 :(得分:-1)

//替换为/////实际上是放置/的转义序列。使用///我们正在逃避转义字符(中间斜杠)。我尝试使用虚拟值的代码,它在Windows 10 Mail中正常工作。 让我再说一遍。

Dim ProjLink As String = "Click on the <a href='http:///abc.gov/Facts/ProjectDetails.aspx?project_pk=" + strProjectid + "'>Link</a>"