我想打开一个弹出窗口并禁用父窗口。下面是我正在使用的代码。由于某种原因,父窗口没有被禁用。我是否需要一些额外的代码或者是什么情况?我还想在父页面被禁用时将其显示为灰色,所以也请帮助我。
<script type="text/javascript">
var popupWindow = null;
function OpenPopup() {
popupWindow = window.open("ClockPopUP.aspx", "Time", "scrollbars=no,resizable=no,width=550,height=350,left=300,top=300");
return false;
}
function parent_disable() {
if (popupWindow && !popupWindow.closed)
popupWindow.focus();
document.onmousedown = focusPopup;
document.onkeyup = focusPopup;
document.onmousemove = focusPopup;
}
function focusPopup() {
if (popupWindow && !popupWindow.closed) { popupWindow.focus(); }
}
function CheckDateEalier(sender, args)
{
var toDate = new Date();
toDate.setMinutes(0);
toDate.setSeconds(0);
toDate.setHours(0);
toDate.setMilliseconds(0);
if (sender._selectedDate < toDate)
{
alert("You can't select day earlier than today! In Case if you are selecting Previous date then, By default it will take current Date.");
sender._selectedDate = toDate;
//set the date back to the current date
sender._textbox.set_Value(sender._selectedDate.format(sender._format))
}
if (sender._selectedDate > toDate)
{
document.getElementById('<%= txtTimeSpent.ClientID%>').disabled = false;
}
}
<asp:Content ID="Content1" ContentPlaceHolderID="cphTop" runat="server" >
<asp:ScriptManager ID="ScriptManger1" runat="server">
<%--<Scripts>
<asp:ScriptReference Path="js/Progress.js"/>
</Scripts>--%>
</asp:ScriptManager>
<asp:UpdatePanel runat="server" ID="updProduction">
<ContentTemplate>
<div id="counter" >
</div>
<div id="content">
<div id="right">
 
<asp:Button ID="Button1" runat="server" Text="Lunch" CausesValidation="false" CssClass="bigbuttons" style="background:url(../App_Themes/Images/green-box.gif)" Font-Bold="True" ForeColor="White" Font-Size="Large" /> <br />
<asp:Button ID="Button2" runat="server" Text="Break" CausesValidation="false" CssClass="bigbuttons" style="background:url(../App_Themes/Images/red-box.gif)" Font-Bold="True" ForeColor="White" Font-Size="Large" /> <br />
<asp:Button ID="Button3" runat="server" Text="L&D Training " CausesValidation="false" CssClass="bigbuttons" style="background:url(../App_Themes/Images/green-box.gif)" Font-Bold="True" ForeColor="White" Font-Size="Large" /> <br />
<asp:Button ID="Button4" runat="server" Text="Shift End" CausesValidation="false" CssClass="bigbuttons" style="background:url(../App_Themes/Images/red-box.gif)" Font-Bold="True" ForeColor="White" Font-Size="Large" /> <br />
</div>
</div>