Hello,
I have developed a calendar program in Javascript which opens a calendar as a popup window and when a user clicks on a date the date is copied into the parent windows textbox.
The code of the parent window is as follows --> - <html>
-
<head>
-
<title>calendar</title>
-
</head>
-
-
<body>
-
<input type="text" name="parent"/>
-
<a href="javascript:void(0);" onClick=window.open("cal_popup.html");>Click here to open the calendar window</a>
-
</body>
-
-
</html>
The code of the popup window is like this --> - <html>
-
-
<head>
-
<title>Calendar</title>
-
<script language="javascript" type="text/javascript">
-
-
function post_value(mm,dt,yy){
-
opener.document.parent.value = mm + "/" + dt + "/" + yy;
-
self.close();
-
}
-
-
-
function gen_cal(prm,chm) {
-
myDate = new Date();
-
-
var m,d,y;
-
if(prm){
-
m=prm+chm;
-
}
-
else{
-
m= myDate.getMonth();
-
}
-
-
d= myDate.getDate(); // Finds today's date
-
y= myDate.getFullYear(); // Finds today's year
-
-
var string = new Date(y,m,d);
-
var newstring = string.toString();
-
var string_array = newstring.split(" ");
-
-
-
// mn --> Month is calculated to display at the top of the calendar for eg: Jan
-
var mn = string_array[1];
-
-
//yn--> Year is calculated to display at the top of the calendar for eg: 2007
-
var yn = string_array[5];
-
-
//no_of_days -->This is to calculate number of days in a month
-
var no_of_days;
-
if(mn == "Jan" || mn == "Mar" || mn == "May" || mn == "Jul" || mn == "Aug" || mn == "Oct" || mn == "Dec")
-
no_of_days = 31;
-
if(mn == "Apr" || mn == "Jun" || mn == "Sep" || mn == "Nov")
-
no_of_days = 30;
-
if(mn == "Feb")
-
if(yn % 4 == 0)
-
no_of_days = 29;
-
else
-
no_of_days = 28;
-
-
//j--> This will have the week day of the first day of the month
-
myArray = new Array("Sun", "Mon", "Tue", "Wed", "Thu","Fri", "Sat");
-
myDate1 = new Date(y,m,1);
-
var newdate1 = myDate1.toString();
-
var string_date = newdate1.split(" ");
-
var j = string_date[0];
-
-
for(i=0;i<myArray.length;i++) {
-
if(myArray[i] == j)
-
j=i;
-
}
-
-
var adj = "<td> </td>";
-
for(k=2; k<=j; k++){ // Adjustment of date starting
-
adj = adj + "<td> </td>";
-
}
-
-
// Starting of top line showing name of the days of the week
-
-
document.write(" <table border='1' bordercolor='#FFFF00' cellspacing='0' cellpadding='0' align=center><tr><td>");
-
-
document.write("<table cellspacing='0' cellpadding='0' align=center width='100' border='1'><td align=center bgcolor='#ffff00'><font size='3' face='Tahoma'> <a href='javascript:gen_cal("+m+",-1);'><</a> </td><td colspan=5 align=center bgcolor='#ffff00'><font size='3' face='Tahoma'>" + mn + yn + "</td><td align=center bgcolor='#ffff00'><font size='3' face='Tahoma'> <a href='javascript:gen_cal("+m+",1);'>></a> </td></tr><tr>");
-
-
document.write("<td><font size='3' face='Tahoma'><b>Sun</b></font></td><td><font size='3' face='Tahoma'><b>Mon</b></font></td><td><font size='3' face='Tahoma'><b>Tue</b></font></td><td><font size='3' face='Tahoma'><b>Wed</b></font></td><td><font size='3' face='Tahoma'><b>Thu</b></font></td><td><font size='3' face='Tahoma'><b>Fri</b></font></td><td><font size='3' face='Tahoma'><b>Sat</b></font></td></tr><tr>");
-
-
////// End of the top line showing name of the days of the week//////////
-
-
//////// Starting of the days//////////
-
var pv;
-
for(i=1;i<=no_of_days;i++){
-
pv = m + "," + i + "," + yn;
-
document.write(adj + "<td valign=top><font size='2' face='Tahoma'><a href='#'onClick='post_value("+pv+");'>" + i + "</a><br>");
-
// This will display the date inside the calendar cell
-
document.write(" </font></td>");
-
adj='';
-
j++;
-
if(j==7){
-
document.write("</tr><tr>");
-
j=0;
-
}
-
}
-
document.write("</tr></table></td></tr></table>");
-
}
-
-
-
</script>
-
</head>
-
-
<body onLoad="javascript:gen_cal();">
-
</body>
-
</html>
Please copy them in two files and run in IE .
There are 2 PROBLEMS -->
1.The month navigation is not working .
2. When we click on a date it should get copied inside a textbox which is not happening.
Please help me in solving this as its very urgent.
7 1729 pbmods 5,821
Recognized Expert Expert Please copy them in two files and run in IE .
If you wanted us to do that, why didn't you just upload your two text files as attachments?
If you wanted us to do that, why didn't you just upload your two text files as attachments?
How to upload files as attachment ?
acoder 16,027
Recognized Expert Moderator MVP
Put your text box inside form tags so you can reference it properly. Also, avoid using names like "parent". You could give it an id instead and use: - document.getElementById(yourid).value=...
I am facing problem in the below section. Its the NAVIGATION part --> - document.write("<table cellspacing='0' cellpadding='0' align=center width='100' border='1'><td align=center bgcolor='#ffff00'><font size='3'> <a href='javascript:gen_cal("+m+",-1);'><</a> </td><td colspan=5 align=center bgcolor='#4444ff'><font size='3' color='white'><b>" + mn + yn + "</b></td><td align=center bgcolor='#ffff00'><font size='3'> <a href='javascript:gen_cal("+m+",1);'>></a> </td></tr><tr>");
Please help.
ok I have uploaded the two files.
cal_popup.html
http://www.megaupload. com/?d=X4ROLHVI
calendar.html
http://www.megaupload. com/?d=P7OP46BY
Please run them in IE and solve the problem.
Only "Navigation " is the problem.
acoder 16,027
Recognized Expert Moderator MVP
What error do you get? Is this problem only in IE or have you not tested on other browsers?
What error do you get? Is this problem only in IE or have you not tested on other browsers?
First please run those files then you will come to know the problem.
Its just a syntax problem of document.write .
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: DFS |
last post by:
If you're listening, I want the middle of the calendar (showing 1 month) to
open below the cursor position. It currently opens just to the right and
below the cursor position.
I hunted through the code, but can't determine what to alter.
Very nice piece of work, by the way.
Thanks
|
by: Miguel Dias Moura |
last post by:
Hello,
i am trying to create a .css file with several styles and apply them to the
calendar control so i can change the look of:
1. Text Type and Format (Bold, Underline, etc)
2. Background Color
3. Foreground Color
4. Border Tickness
5. Border Color
|
by: maxrawson |
last post by:
First, let me start by saying my asp.net experience is still in it's
infancy so please bare with me as I try to explain my situation.
I have created a single page that with the use of many controls (i.e.
roundedcorners component www.4guysfromrolla.com], buttons and
panels) functions like a tab control. The buttons are programmatically
designed to make the corresponding panel visible.
Sample aspx.vb code:
|
by: Caesar Augustus |
last post by:
First, let me start by saying my asp.net experience is still in it's
infancy so please bare with me as I try to explain my situation.
I have created a single page that with the use of many controls (i.e.
roundedcorners component www.4guysfromrolla.com], buttons and
panels) functions like a tab control. The buttons are
programmatically designed to make the corresponding panel visible.
Sample aspx.vb code:
|
by: =?Utf-8?B?UGFycm90?= |
last post by:
I applied the following Ajax code in my web page which has a calendar control
to keep my page from completely reloading everytime something was changed.
<atlas:ScriptManager ID="ScriptManager1" runat="server"
EnablePartialRendering="true"/>
<atlas:UpdatePanel runat="server" ID="UpdatePanel1" Mode="Conditional">
<ContentTemplate>
After inserting this code, my calendar stopped working in that if I clicked
on a date, nothing would...
| |
by: =?Utf-8?B?Tkg=?= |
last post by:
I have a basic calendar and a SelectionChanged event (asp.net 2.0).
How can I handle it when a user chooses the same date again, in this case
the SelectionChanged event is not fired because, well, the date selected
hasnt changed.
Is there a calendar.clearSelection type method on the calendar I can use?
|
by: thorpk |
last post by:
I posted this problem earlier in the month and some one decided it was
better to change the subject and ask a completely different question.
I am therefore reposting. I am hoping some one can assist with this.
Thanks in advance.
I have an access database that i have added a pop up calendar to, the
Table information for the Date Reported field is
Date/Time
format short date,
input mask is 00/00/0000.
|
by: mathewgk80 |
last post by:
HI all,
I am having popup calendar Javascript code. But i dont know how it is connecting to asp.net code.. I am using asp.net,c#.net and also using 3tier architecture with master page....
I would like to get the code for connecting the javascript to asp.net page...
Please help me...
The javascript code is as follows..
|
by: gubbachchi |
last post by:
Hi all,
Please anybody help me solve this problem. I am stuck up with this from past 2 weeks. I am developing an application where, when the user selects date from javascript datepicker and enters the comments and clicks the save button then the date and the date will be stored in the mysql database. This is working fine. But my problem is when, after the user had made an entry the date in the calendar for which an entry has made should be...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |