Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Interview-Questions Calendar window is not showing the textbox values for the Dynamic rows in html page
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


pradeep
Calendar window is not showing the textbox values for the Dynamic rows in html page
0 Answer(s)      4 years and 7 months ago
Posted in : Java Interview Questions


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>

Advertisement
View Answers

Related Tutorials/Questions & Answers:
Calendar window is not showing the textbox values for the Dynamic rows in html page - Java Interview Questions
Calendar window is not showing the textbox values for the Dynamic rows in html... is not showing in textbox please help to me it is very urgent for me Add/Remove dynamic rows in HTML table window.history.forward(1
Calendar window is not coming for the Dynamic rows in html page - JSP-Servlet
Calendar window is not coming for the Dynamic rows in html page  Calendar window is not coming for the Dynamic rows in html page. I have 3 textboxes. one column is having the date textbox .I need to add the calendar icon
Advertisements
how to add the calendar to the dynamic rows in html or jsp page - JSP-Servlet
how to add the calendar to the dynamic rows in html or jsp page   Hi Sir, i have 3 columns in my jsp page date of payment,amount recieved,no and i have 2 button in my jsp page ADD and delete button. when i click on add
How to insert dynamic textbox values into database using Java?
How to insert dynamic textbox values into database using Java?  Hi I am trying to insert dynamic textbox values to database, my jsp form have 2... these dynamic textbox values to database(Oracle 11g)...Please help me out. I have
showing the information of database in textbox
showing the information of database in textbox  how to make a information of a database make appear to the user in the textbox
dynamic generation of html:select tag from textbox value
dynamic generation of html:select tag from textbox value  Hi, I am a newbie to java and struts. In my application, I have a requirement like when i give some input in a textbox and click on a add link. It should be added
dynamic generation of html:select tag from textbox value
dynamic generation of html:select tag from textbox value  Hi, I am a newbie to java and struts. In my application, I have a requirement like when i give some input in a textbox and click on a add link. It should be added
retaining textbox values
retaining 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
passing textbox value from one page to another page using html n javascript
passing textbox value from one page to another page using html n... of variable at onclick event of button and also want to print it in textbox on the othe (next/prevoious)page please help me   1)page1.html: <html>
Hiding and showing elements on the page
Hiding and showing elements on the page       Hiding and showing elements on the page... : jqHIdeShowText . html <!DOCTYPE html> <
how to pass form values from javascript of html page to jsp page
how to pass form values from javascript of html page to jsp page   This is my sample html page which contains inline javascript which calculates... to submit all the form values with lattitude and longitude returned from
store dynamic generated textbox value into database
store dynamic generated textbox value into database  sir, how do i store dynamically generated textbox value into the database thanks in advance
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
get date picker values to a textbox
get 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
Dynamic HREF link - Date Calendar
Dynamic 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
dynamic web pages in html
dynamic web pages in html  How to create Dynamic web pages in HTML
i want to create dynamic calendar in java
i want to create dynamic calendar in java  i want code and explanation
i want to create dynamic calendar in java
i want to create dynamic calendar in java  i want code and explanation
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
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 examples
Dynamic html examples  Hi, What is Dynamic HTML? Explain with dynamic html examples. Thanks   Hi, DHTML stands for Dynamic HTML and is uses the HTML, JavaScript, DOM, & CSS in a program. Following is very simple
static page and dynamic pages?
static page and dynamic pages?  what is the static page and dynamic pages
static page and dynamic pages?
static page and dynamic pages?  what is the diff between static page and dynamic pages
static page and dynamic pages?
static page and dynamic pages?  what is the static page and dynamic pages adv and disadv
How to display current date in textbox - Date Calendar
;% } This is my problem: I want to display current date in textbox... show in textbox. Please help me to solve that problem, I will wait your answer
To put a "close window" link on a page?
To put a "close window" link on a page?  To put a "close window" link on a page
Retaining textBox values in java - Java Beginners
Retaining 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
JSP textbox autopopulation on basis of SQL table values
JSP textbox autopopulation on basis of SQL table values  Hi, I need to achieve the following on J2EE platform Could you please help? The following table is created in MySQL DB: Problem type Status Responsible LEGAL
how to retreive values from MS Access Database based on the values entered in textbox values in jsp file
how to retreive values from MS Access Database based on the values entered in textbox values in jsp file  Hi am new to java. i need to create a dynamic web application. Am using eclipse IDE and Apache tomcat server. i need
Populate value into HTML page
Populate value into HTML page  Hi, How to populate values from one html page table to another html page..? Thanks
 

 

 

DMCA.com