【发布时间】:2020-02-21 11:29:54
【问题描述】:
我是 ASP.NET MVC 和 Web 开发的新手,我不知道如何实现全屏和退出按钮
到目前为止,这是我的退出按钮:
<body>
<div id="exit" class="exit">
@Html.ActionLink("⠀x⠀", null, null, new { @class = "btnclose", id = "close", style = "color: black; font-size:large; font-weight:bold; background-color:red; border-color:#3f464c; border:solid; border-width: 2px" })
</div>
</body>
<script>
function closewindow() {
$("#close").click(function () {
window.close();
});
};
</script>
这是我的全屏按钮
<body>
<div align="center">
<input type="button" name="btnFullscreen" value="Go Fullscreen" style="font-size:xx-large; font-weight:bold; width:500px; height:300px; text-align:center; background-color:#e87a3a; border-color:#3f464c" onclick="goFullscreen()" />
</div>
<body>
<script>
function goFullscreen() {
location.replace("/Gauge/GaugeView");
var el = document.documentElement
, rfs = // for newer Webkit and Firefox
el.requestFullscreen
|| el.webkitRequestFullScreen
|| el.mozRequestFullScreen
|| el.msRequestFullscreen
;
if (typeof rfs != "undefined" && rfs) {
rfs.call(el);
} else if (typeof window.ActiveXObject != "undefined") {
// for Internet Explorer
var wscript = new ActiveXObject("WScript.Shell");
if (wscript != null) {
wscript.SendKeys("{F11}");
}
}
}
【问题讨论】:
-
你的代码几乎接近工作了。任何方式你甚至可以为点击事件添加一个事件监听器,比如
addEventListener("click", function () { });,它也可以正常工作。
标签: javascript html asp.net-mvc model-view-controller