/    Sign up×
Community /Pin to ProfileBookmark

document.close hanging app

I’ve made modifications to the date picker, date-picker.js, source code to edit the selected date value. I have no problem displaying the calendar and calling my date edit function, but when I use an option to redisplay a different month the application hangs (not responding). I have to end the task using Task Manager. Using alerts, it appears that the document.close statement never completes when displaying a different month.

I’ve added the call to my edit function, checkDateSel, as part of the onclick statement and the script tag to include the source code. I’m including the source code that was modified. Could someone explain why my modifications are causing this problem?

Thanks,
Tom

added to onclick:

[CODE]checkDateSel(self.opener.document.” + this.gReturnItem + “);[/CODE]

[CODE] for (j=0; j<7; j++) {

vCode = vCode + “<TD WIDTH=’14%'” + this.write_weekend_string(j) + “><FONT SIZE=’2′ FACE='” + fontface + “‘>” +
“<A HREF=’#’ ” +
“onClick=”self.opener.document.” + this.gReturnItem + “.value='” +
this.format_data(vDay) +
“‘; checkDateSel(self.opener.document.” + this.gReturnItem + “); window.close();”>” +
this.format_day(vDay) +
“</A>” +
“</FONT></TD>”;

vDay=vDay + 1;

if (vDay > vLastDay) {
vOnLastDay = 1;
break;
}
}[/CODE]

added to show:

[CODE]this.wwrite (“<SCRIPT type=”text/javascript” src=”js/LR_Date.js”></SCRIPT>”); [/CODE]
[CODE]Calendar.prototype.show = function() {
alert (“entering show”);
var vCode = “”;

this.gWinCal.document.open();

// Setup the page…
this.wwrite(“<html>”);
this.wwrite(“<head><title>Calendar</title>”);
this.wwrite (“<SCRIPT type=”text/javascript” src=”js/LR_Date.js”></SCRIPT>”); **this line was added**
this.wwrite(“</head>”);

this.wwrite(“<body ” +
“link=”” + this.gLinkColor + “” ” +
“vlink=”” + this.gLinkColor + “” ” +
“alink=”” + this.gLinkColor + “” ” +
“text=”” + this.gTextColor + “”>”);
this.wwriteA(“<FONT FACE='” + fontface + “‘ SIZE=2><B>”);
this.wwriteA(this.gMonthName + ” ” + this.gYear);
this.wwriteA(“</B><BR>”);

// Show navigation buttons
var prevMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, -1);
var prevMM = prevMMYYYY[0];
var prevYYYY = prevMMYYYY[1];

var nextMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, 1);
var nextMM = nextMMYYYY[0];
var nextYYYY = nextMMYYYY[1];

this.wwrite(“<TABLE WIDTH=’100%’ BORDER=1 CELLSPACING=0 CELLPADDING=0 BGCOLOR=’#e0e0e0′><TR><TD ALIGN=center>”);
this.wwrite(“[<A HREF=”” +
“javascript:window.opener.Build(” +
“‘” + this.gReturnItem + “‘, ‘” + this.gMonth + “‘, ‘” + (parseInt(this.gYear)-1) + “‘, ‘” + this.gFormat + “‘” +
“);” +
“”><<</A>]</TD><TD ALIGN=center>”);
this.wwrite(“[<A HREF=”” +
“javascript:window.opener.Build(” +
“‘” + this.gReturnItem + “‘, ‘” + prevMM + “‘, ‘” + prevYYYY + “‘, ‘” + this.gFormat + “‘” +
“);” +
“”><</A>]</TD><TD ALIGN=center>”);
this.wwrite(“[<A HREF=”javascript:window.print();”>Print</A>]</TD><TD ALIGN=center>”);
this.wwrite(“[<A HREF=”” +
“javascript:window.opener.Build(” +
“‘” + this.gReturnItem + “‘, ‘” + nextMM + “‘, ‘” + nextYYYY + “‘, ‘” + this.gFormat + “‘” +
“);” +
“”>></A>]</TD><TD ALIGN=center>”);
this.wwrite(“[<A HREF=”” +
“javascript:window.opener.Build(” +
“‘” + this.gReturnItem + “‘, ‘” + this.gMonth + “‘, ‘” + (parseInt(this.gYear)+1) + “‘, ‘” + this.gFormat + “‘” +
“);” +
“”>>></A>]</TD></TR></TABLE><BR>”);

// Get the complete calendar code for the month..
vCode = this.getMonthlyCalendarCode();
this.wwrite(vCode);

this.wwrite(“</font></body></html>”);
alert (“gWinCal = ‘” + this.gWinCal + “‘ “);
this.gWinCal.document.close();
alert (“leaving show”);
}[/CODE]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @c62ip64 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...