How to disable minimize, maximize button in the brow开发者_开发百科ser using JavaScript?
You cannot (consistently). Deliberately malicious actions are generally restricted by browsers.
window.open("mypage.html","mywindowname", "toolbar=no,menubar=no");
WIll give you a new window without the menubar and without the toolbar. That's what I'm assuming you want when you say "disable". If you just want to disable the functionality while still showing the buttons, then you can't.
Look here for a reference on the window.open() method.
Here is another approach, you can send key strokes for Alt, Space,N.
<SCRIPT LANGUAGE="JavaScript">
var WshShell = new ActiveXObject("WScript.Shell");
function Minimize()
{
WshShell.SendKeys("% n");
}
</SCRIPT>
</HEAD>
<BODY >
<TABLE width=100%>
<TR align=right>
<TD><input type="button" name="Button" onclick="Minimize()" value="minimize" /></TD>
</TR>
</TABLE>
</BODY>
For Firefox:
<script>
window.open("http://www.google.com/", "Google", "dialog=yes");
</script>
精彩评论