我有一个MVC应用程序,其中包含用于打印信息的链接。打印链接在javascript中。 代码如下:
<td>
<%= Html.TextBox("Name", Model.ApplicantStatus.Name) %>
<%= Html.ValidationMessage("Name", "*") %>
</td>
<script type="text/javascript">
var myEmail = "ChangeMe@abc.org";
var mySubject = "Sample";
var myBody = "My name is ";
var myName = Model.TableName.Name;
document.write('<a href="mailto:' + myEmail + '?subject=' + mySubject + '&body=' + myBody + myname + '">email me</a>');
</script>
基本上var myName = Model.TableName.Name;不管用。任何解决方法?
答案 0 :(得分:1)
将行更改为
var myName = <%=Model.TableName.Name%>;