我有一个ASP.NET MVC4应用程序,我有这个视图:
@{
Layout = "~/Views/Shared/Template.cshtml";
}
@section logout {
<a href='@Url.Action("Logout", "Begin")' style="margin-left: 91.3%"><img src="~/Content/images/images.jpg" style="width:37px; height:37px" /></a>
}
<html>
<head>
<script>
function mailJob(code) {
window.open('mailto:example@gmail.com');
}
</script>
</head>
<body>
<form action="/Pages/Index" method="post" style="margin-left:20%">
<div class ="CenterTitle">
<h1 style="color:rgb(73, 140, 212)">Norm impact : Registre des réclamations clients</h1>
</div>
<div class="noPrint">
<input type="hidden" value ="1" name="Pages"/>
<button type="submit" value="Submit" name="btnPage1"><img src="~/Content/images/OK.png" onclick="mailJob('Sample');"/></button>
<button type="button" value="exportToPDF" onclick="window.print()" name="btnPage1"style="margin-left:55%"><img src="~/Content/images/print.png" /></button>
</div>
...
<div class="noPrint">
<button type="submit" value="Page2" name="btnPage1" style="margin-left:75%"><img src="~/Content/images/next.png" /></button>
</div>
</form>
</body></html>
问题出在mailto
,因为邮件软件没有启动,而是带有此网址mailto:example@gmail.com
的新窗口。
那么我该如何解决这个问题呢?
答案 0 :(得分:1)
请改为尝试:
function mailJob(code) {
window.location.href = 'mailto:example@gmail.com';
}