在controller中加入代码 ViewBag.js="<script>alert('弹出框');</script>"; 在视图中加入代码 @Html.Raw(ViewBag.js) 转载于:https://www.cnblogs.com/sydeveloper/p/3680582.html