Calendar window is not showing the textbox values for the Dynamic rows in html page
My code is here now.When i click on calendar ,value is not showing in textbox please help to me it is very urgent for me
<HTML>
<HEAD>
<TITLE> Add/Remove dynamic rows in HTML table </TITLE>
<script type="text/javascript" src="datepickercontrol.js"></script>
<link type="text/css" rel="stylesheet" href="datepickercontrol.css">
</script>
<script language="JavaScript" type="text/javascript">
window.history.forward(1);
</script>
<script language="JavaScript" src="calendar_us.js"></script>
<link rel="stylesheet" href="calendar.css">
<SCRIPT language="javascript">
function addRow(tableID) {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
var colCount = table.rows[0].cells.length;
for(var i=0; i<colCount; i++) {
var newcell = row.insertCell(i);
newcell.innerHTML = table.rows[0].cells[i].innerHTML;
//alert(newcell.childNodes);
switch(newcell.childNodes[0].type) {
case "text":
newcell.childNodes[0].value = "";
break;
case "checkbox":
newcell.childNodes[0].checked = false;
break;
case "select-one":
newcell.childNodes[0].selectedIndex = 0;
break;
}
}
}
function deleteRow(tableID) {
try {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
for(var i=0; i<rowCount; i++) {
var row = table.rows[i];
var chkbox = row.cells[0].childNodes[0];
if(null != chkbox && true == chkbox.checked) {
if(rowCount <= 1) {
alert("Cannot delete all the rows.");
break;
}
table.deleteRow(i);
rowCount--;
i--;
}
}
}catch(e) {
alert(e);
}
}
</SCRIPT>
<script language="JavaScript">
//Script by Denis Gritcyuk: tspicker@yahoo.com
// Title: Timestamp picker
// Description: See the demo at url
// URL: http://us.geocities.com/tspicker/
// Version: 1.0
// Date: 12-05-2001 (mm-dd-yyyy)
// Author: Denis Gritcyuk <denis@softcomplex.com>; <tspicker@yahoo.com>
// Notes: Permission given to use this script in any kind of applications if
// header lines are left unchanged. Feel free to contact the author
// for feature requests and/or donations
function show_calendar(str_target, str_datetime) {
var arr_months = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"];
var week_days = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
var n_weekstart = 1; // day week starts from (normally 0 or 1)
var dt_datetime = (str_datetime == null || str_datetime =="" ? new Date() : str2dt(str_datetime));
var dt_prev_month = new Date(dt_datetime);
dt_prev_month.setMonth(dt_datetime.getMonth()-1);
var dt_next_month = new Date(dt_datetime);
dt_next_month.setMonth(dt_datetime.getMonth()+1);
var dt_firstday = new Date(dt_datetime);
dt_firstday.setDate(1);
dt_firstday.setDate(1-(7+dt_firstday.getDay()-n_weekstart)%7);
var dt_lastday = new Date(dt_next_month);
dt_lastday.setDate(0);
// html generation (feel free to tune it for your particular application)
// print calendar header
var str_buffer = new String (
"<html>\n"+
"<head>\n"+
" <title>Calendar</title>\n"+
"</head>\n"+
"<body bgcolor=\"White\">\n"+
"<table class=\"clsOTable\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n"+
"<tr><td bgcolor=\"#4682B4\">\n"+
"<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"100%\">\n"+
"<tr>\n <td bgcolor=\"#4682B4\"><a href=\"javascript:window.opener.show_calendar('"+
str_target+"', '"+ dt2dtstr(dt_prev_month)+"'+document.cal.time.value);\">"+
"<img src=\"prev.gif\" width=\"16\" height=\"16\" border=\"0\""+
" alt=\"previous month\"></a></td>\n"+
" <td bgcolor=\"#4682B4\" colspan=\"5\">"+
"<font color=\"white\" face=\"tahoma, verdana\" size=\"2\">"
+arr_months[dt_datetime.getMonth()]+" "+dt_datetime.getFullYear()+"</font></td>\n"+
" <td bgcolor=\"#4682B4\" align=\"right\"><a href=\"javascript:window.opener.show_calendar('"
+str_target+"', '"+dt2dtstr(dt_next_month)+"'+document.cal.time.value);\">"+
"<img src=\"next.gif\" width=\"16\" height=\"16\" border=\"0\""+
" alt=\"next month\"></a></td>\n</tr>\n"
);
var dt_current_day = new Date(dt_firstday);
// print weekdays titles
str_buffer += "<tr>\n";
for (var n=0; n<7; n++)
str_buffer += " <td bgcolor=\"#87CEFA\">"+
"<font color=\"white\" face=\"tahoma, verdana\" size=\"2\">"+
week_days[(n_weekstart+n)%7]+"</font></td>\n";
// print calendar table
str_buffer += "</tr>\n";
while (dt_current_day.getMonth() == dt_datetime.getMonth() ||
dt_current_day.getMonth() == dt_firstday.getMonth()) {
// print row heder
str_buffer += "<tr>\n";
for (var n_current_wday=0; n_current_wday<7; n_current_wday++) {
if (dt_current_day.getDate() == dt_datetime.getDate() &&
dt_current_day.getMonth() == dt_datetime.getMonth())
// print current date
str_buffer += " <td bgcolor=\"#FFB6C1\" align=\"right\">";
else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6)
// weekend days
str_buffer += " <td bgcolor=\"#DBEAF5\" align=\"right\">";
else
// print working days of current month
str_buffer += " <td bgcolor=\"white\" align=\"right\">";
if (dt_current_day.getMonth() == dt_datetime.getMonth())
// print days of current month
str_buffer += "<a href=\"javascript:window.opener."+str_target+
".value='"+dt2dtstr(dt_current_day)+"'+document.cal.time.value; window.close();\">"+
"<font color=\"black\" face=\"tahoma, verdana\" size=\"2\">";
else
// print days of other months
str_buffer += "<a href=\"javascript:window.opener."+str_target+
".value='"+dt2dtstr(dt_current_day)+"'+document.cal.time.value; window.close();\">"+
"<font color=\"gray\" face=\"tahoma, verdana\" size=\"2\">";
str_buffer += dt_current_day.getDate()+"</font></a></td>\n";
dt_current_day.setDate(dt_current_day.getDate()+1);
}
// print row footer
str_buffer += "</tr>\n";
}
// print calendar footer
str_buffer +=
"<form name=\"cal\">\n<tr><td colspan=\"7\" bgcolor=\"#87CEFA\">"+
"<font color=\"White\" face=\"tahoma, verdana\" size=\"2\">"+
"Time: <input type=\"text\" name=\"time\" value=\""+dt2tmstr(dt_datetime)+
"\" size=\"8\" maxlength=\"8\"></font></td></tr>\n</form>\n" +
"</table>\n" +
"</tr>\n</td>\n</table>\n" +
"</body>\n" +
"</html>\n";
var vWinCal = window.open("", "Calendar",
"width=200,height=250,status=no,resizable=yes,top=200,left=200");
vWinCal.opener = self;
var calc_doc = vWinCal.document;
calc_doc.write (str_buffer);
calc_doc.close();
}
// datetime parsing and formatting routimes. modify them if you wish other datetime format
function str2dt (str_datetime) {
var re_date = /^(\d+)\-(\d+)\-(\d+)\s+(\d+)\:(\d+)\:(\d+)$/;
if (!re_date.exec(str_datetime))
return alert("Invalid Datetime format: "+ str_datetime);
return (new Date (RegExp.$3, RegExp.$2-1, RegExp.$1, RegExp.$4, RegExp.$5, RegExp.$6));
}
function dt2dtstr (dt_datetime) {
return (new String (
dt_datetime.getDate()+"-"+(dt_datetime.getMonth()+1)+"-"+dt_datetime.getFullYear()+" "));
}
function dt2tmstr (dt_datetime) {
return (new String (
dt_datetime.getHours()+":"+dt_datetime.getMinutes()+":"+dt_datetime.getSeconds()));
}
</script>
</HEAD>
<BODY>
<form name="tstest" >
<INPUT type="button" value="Add Row" onclick="addRow('dataTable')" />
<INPUT type="button" value="Delete Row" onclick="deleteRow('dataTable')" />
<TABLE id="dataTable" width="350px" border="1">
<TR>
<TD><INPUT type="checkbox" name="chk"/></TD>
<TD><input type="Text" name="timestamp" value="">
<a href="javascript:show_calendar('document.tstest.timestamp', document.tstest.timestamp.value);"><img src="cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the timestamp"></a></TD>
<TD>
<SELECT name="country">
<OPTION value="in">India</OPTION>
<OPTION value="de">Germany</OPTION>
<OPTION value="fr">France</OPTION>
<OPTION value="us">United States</OPTION>
<OPTION value="ch">Switzerland</OPTION>
</SELECT>
</TD>
</TR>
</TABLE>
</form>
</BODY>
</HTML>
View Answers
Related Tutorials/Questions & Answers:
Advertisements
retaining textbox valuesretaining
textbox values i have a calculator program, when i press a button the value displays but disappears when i press another button so how can i keep
values to display when i press multiple buttons
get date picker values to a textboxget date picker
values to a textbox I am using DatePicker to select date in a form in asp.net using c#. I need the picked data to get in to a
textbox. Please help me soon
Passing values from child window to parent window.Passing
values from child
window to parent
window. Hai,
I'm having... check boxes those check box
values should be shown in the parent
window,which will have some more
values in it.The
values which are selected from child
window Passing values from child window to parent window.Passing
values from child
window to parent
window. http://www.roseindia.net/java/pass-value-example/pass-value-child-to-parent.shtml
I have gone thru the link but my requirement is checkboxes.can u please explain
Pass value from child to parent window
Pass value from child to parent
window
Java example program to pass value from child
window
to parent
window
We can pass
values from a child
window in
Html to the
parent
Dynamic html examplesDynamic html examples Hi,
What is
Dynamic HTML? Explain with
dynamic html examples.
Thanks
(adsbygoogle = window.adsbygoogle || []).push({});
Hi,
DHTML stands for
Dynamic HTML and is uses the
HTML Retaining textBox values in java - Java BeginnersRetaining
textBox values in java Hi all,
i have a jsp screen where i have two actions .
I have a single
textbox and two buttons.
My
textbox value is becoming null once i click on any one button.
I want the
textbox value
Dynamic HREF link - Date CalendarDynamic HREF link Hi, I want to know how to create a
page with links to download the files present in one folder and if the no of files present in the folder changes the link for downloading changes automatically.
For eg
date in textbox on page load date in
textbox on
page load i want to insret the current date in
textbox but this code dosen't work and the value of text box will be blank... into
textbox on
page load.
<html>
<script>
function addDate(){
date = new
Printing Values of Resultset to Html Table in advance
JSP Display
values of ResultSet to
HTML table:
<%@
page...Printing
Values of Resultset to
Html Table I have a resultset and I need to collect the resultset
values into the arraylist into
a table
how to store a dynamic values - JSP-Servlethow to store a
dynamic values Dear sir,
i have a ArrayList in that i have stored a
values from a excel sheet specified column
values and i... and bonus is ~5 .
Thanks Hr
in another arraylist i have a
values ~2,~3
Populate values from html to another htmlPopulate
values from
html to another
html
In this tutorial, you will learn how to send
values from one
html page to
another. Here, we have create a
html... on another
html page.
page1.html:
<html>
<form type=get action="
How to retrieve array values from html form to jsp?How to retrieve array
values from
html form to jsp? Hi! I am developing an
dynamic user interface. I hv developed
html forms and i wat to convert it into jsp. Means i just want to retrieve
values from
html form containing array
display all the values on next page when i return on first
page it should display my selected
values in
textbox...
values are inserting in the database and i am moving on another
page after...display all the
values on next page i am inserting
values problem in sending more than 500 values to a jsp pageproblem in sending more than 500
values to a jsp page when i am trying to send more than 500
values from a
html form to a jsp
page browser is
showing that server is not sending any data...I have configured tomcat5.5
how to fetch values from .properties to a html filehow to fetch
values from .properties to a
html file I have a .properties file with some key value pairs in it. I need to fetch the
values from this .properties file into a
html file.Please let me know how to do
inserting all the values in a html table columninserting all the
values in a
html table column strong text
hai everyone,
i'm a fresher to servlet i need to know that, how can i insert all the
values in a
html table column into a database.
Thanks in advance
html-jsphtml-jsp If i want to get
dynamic value in
html textbox or in jsp,then how can I get the value,how the value will be transfered from servlet
page to the
html textbox.Thanx in advance.....Kindly help me