Good morning all,
Please I need help in a form that I have designed to fill user information. This form needs two drop-down list about specific date, one about contract date, and the other about birth date. I am using java script function to display the dates, and use onload() function to set the drop-down list to the current date.
I following error used to appear (null or not an object)!! Can any one help me in that?
The code:
[HTML]<head>
<SCRIPT LANGUAGE="JavaS cript">
//set todays date
Now = new Date();
NowDay = Now.getDate();
NowMonth = Now.getMonth();
NowYear = Now.getYear();
if (NowYear < 2000) NowYear += 1900; //for Netscape
//function for returning how many days there are in a month including leap years
function DaysInMonth(Whi chMonth, WhichYear)
{
var DaysInMonth = 31;
if (WhichMonth == "Apr" || WhichMonth == "Jun" || WhichMonth == "Sep" || WhichMonth == "Nov") DaysInMonth = 30;
if (WhichMonth == "Feb" && (WhichYear/4) != Math.floor(Whic hYear/4)) DaysInMonth = 28;
if (WhichMonth == "Feb" && (WhichYear/4) == Math.floor(Whic hYear/4)) DaysInMonth = 29;
return DaysInMonth;
}
//function to change the available days in a months
function ChangeOptionDay s(Which)
{
DaysObject = eval("document. Englishform." + Which + "Day");
MonthObject = eval("document. Englishform." + Which + "Month");
YearObject = eval("document. Englishform." + Which + "Year");
Month = MonthObject[MonthObject.sel ectedIndex].text;
Year = YearObject[YearObject.sele ctedIndex].text;
DaysForThisSele ction = DaysInMonth(Mon th, Year);
CurrentDaysInSe lection = DaysObject.leng th;
if (CurrentDaysInS election > DaysForThisSele ction)
{
for (i=0; i<(CurrentDaysI nSelection-DaysForThisSele ction); i++)
{
DaysObject.opti ons[DaysObject.opti ons.length - 1] = null
}
}
if (DaysForThisSel ection > CurrentDaysInSe lection)
{
for (i=0; i<(DaysForThisS election-CurrentDaysInSe lection); i++)
{
NewOption = new Option(DaysObje ct.options.leng th + 1);
DaysObject.add( NewOption);
}
}
if (DaysObject.sel ectedIndex < 0) DaysObject.sele ctedIndex == 0;
}
//function to set options to today
function SetToToday(Whic h)
{
DaysObject = eval("document. Englishform." + Which + "Day");
MonthObject = eval("document. Englishform." + Which + "Month");
YearObject = eval("document. Englishform." + Which + "Year");
YearObject[0].selected = true;
MonthObject[NowMonth].selected = true;
ChangeOptionDay s(Which);
DaysObject[NowDay-1].selected = true;
}
//function to write option years minus x
function WriteYearOption s(YearsAhead)
{
line = "";
for (i=0; i<YearsAhead; i++)
{
line += "<OPTION>";
line += NowYear--;
}
return line;
}
// End -->
</script>
</head>
<body onLoad="SetToTo day('FirstSelec t');" >
<FORM NAME="Englishfo rm" >
<!-- Contract date -->
<LABEL>Contra ct date</LABEL>
<SELECT name="FirstSele ctDay"> <OPTION>1 <OPTION>2 <OPTION>3 <OPTION>4 <OPTION>5 <OPTION>6 <OPTION>7 <OPTION>8 <OPTION>9 <OPTION>10 <OPTION>11 <OPTION>12 <OPTION>13 <OPTION>14 <OPTION>15 <OPTION>16
<OPTION>17 <OPTION>18 <OPTION>19 <OPTION>20 <OPTION>21 <OPTION>22 <OPTION>23 <OPTION>24 <OPTION>25 <OPTION>26 <OPTION>27 <OPTION>28 <OPTION>29 <OPTION>30 <OPTION>31 </SELECT>
<SELECT name="FirstSele ctMonth" onchange="Chang eOptionDays('Fi rstSelect')"><O PTION>Jan <OPTION>Feb <OPTION>Mar<OPT ION>Apr <OPTION>May <OPTION>Jun <OPTION>Jul <OPTION>Aug <OPTION>Sep <OPTION>Oct <OPTION>Nov <OPTION>Dec</SELECT>
<SELECT name="FirstSele ctYear" onchange="Chang eOptionDays('Fi rstSelect')"> <SCRIPT language="JavaS cript">
document.write( WriteYearOption s(10)); </SCRIPT></SELECT>
</DIV><br>
<!-- Date of birth -->
<LABEL>Date of issue</LABEL>
<DIV>
<SELECT name="FirstSele ctDay2"> <OPTION>1 <OPTION>2 <OPTION>3 <OPTION>4 <OPTION>5 <OPTION>6 <OPTION>7
<OPTION>8 <OPTION>9 <OPTION>10 <OPTION>11 <OPTION>12 <OPTION>13 <OPTION>14 <OPTION>15 <OPTION>16
<OPTION>17 <OPTION>18 <OPTION>19 <OPTION>20 <OPTION>21 <OPTION>22 <OPTION>23 <OPTION>24 <OPTION>25
<OPTION>26 <OPTION>27 <OPTION>28 <OPTION>29 <OPTION>30 <OPTION>31</SELECT>
<SELECT name="FirstSele ctMonth2" onchange="Chang eOptionDays('Fi rstSelect')"> <OPTION>Jan <OPTION>Feb <OPTION>Mar
<OPTION>Apr <OPTION>May <OPTION>Jun <OPTION>Jul <OPTION>Aug <OPTION>Sep <OPTION>Oct <OPTION>Nov <OPTION>Dec</SELECT>
<SELECT name="FirstSele ctYear2" onchange="Chang eOptionDays('Fi rstSelect')"> <SCRIPT language="JavaS cript">
document.write( WriteYearOption s(50)); </SCRIPT></SELECT>
</DIV><br>
<INPUT type=submit value=Submit name=Submit></DIV><br>
</FORM>
</div>
</body>
</html>[/HTML]
3 1897 acoder 16,027
Recognized Expert Moderator MVP
Welcome to TSDN!
What line does the error occur on?
Thanks for replying !
Line 100. Plz help me through :(
acoder 16,027
Recognized Expert Moderator MVP
The add() method of the select object has two arguments in standard-compliant browsers (i.e. browsers other than IE). See, for example, this link.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Ryan |
last post by:
Just a quicky about temporarary tables. If using QA, when you create a
temporary table, it gets dropped if you close the query. Otherwise you
need to state 'DROP TABLE myTable' so that you can re-run the query
without the table being there.
Sometimes, you can have quite lengthy SQL statements (in a series)
with various drop table sections throughout the query. Ideally you
would put these all at the end, but sometimes you will need to...
|
by: hemant_mishal |
last post by:
Hi All,
I am writting a java script library which will provide inter frame drag
and drop operation. The more precise will be OLE drag and drop, which
means only data will be transfered from frame to frame not any object.
But it should happen in a drag and drop fashion. The requirement is,
user will click on one object and will drag the mouse to another frame
and will drop on some object the data will be passed by this and some
action will...
|
by: Ian Dobson |
last post by:
Hi, I need to drop a schema from a database but it has 400 tables in it.
Is there an easy way to do it other than
drop table schema1.table1
drop table schema1.table2
etc.. to 400 and then
drop schema schema1?
thanks
|
by: BuddhaBuddy |
last post by:
Platform is DB2/NT 7.2.9
The table was created like this:
CREATE TABLE MYTEST (
MYTESTOID bigint not null primary key,
FK_OTHEROID bigint not null references other,
FK_ANOTHEROID bigint not null references another,
FK_LASTLYOID bigint not null references lastly,
unique (FK_OTHEROID,FK_ANOTHEROID))
|
by: Lauren Quantrell |
last post by:
I'm trying to drop a file from Windows Explorer (or desktop, etc.)
onto a field in Access2K and capture the full file path.
I found an posting below that says this is possible but I cannot
simutate it.
Can anyone help?
Thanks
**************************
previous post:
Message 1 in thread
| |
by: VB Programmer |
last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2
listboxes? Thanks!
|
by: Markus |
last post by:
I tried this:
ALTER TABLE Dokumente
DROP COLUMN docPrioID
but I get this errormessage:
DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: COLUMN;ABLE
Dokumente
DROP;CONSTRAINT
|
by: Darren |
last post by:
I'm trying to create a file using drag and drop.
I want to be able to select a listview item drag it to the shell and create a file.
Each icon in the listview represents a blob in a database.
When I drop onto the shell I want a file created with a specified name containing the data from the database.
I've looked at the FileDrop format but it look to have only the filename and not the data.
TIA
|
by: joey.powell |
last post by:
I have a Windows Forms application where I need to be able to drag and
then drop onto a datagridview control. I already have the code
necessary to make the drag part work. I am having problems, however,
when I attempt to drop onto a cell in the datagridview. So far
I have done the following with the datagridview control...
1. I set "AllowDrop" to true.
2. In the DragEnter event I put this...
|
by: RHSFSS |
last post by:
Hi, I have a Drag and Drop registration problem (See http://www.thescripts.com/forum/thread434707.html for similar problem post), can anyone out thereadvise on the best solution?
I have a .NET 2.0 application (actually in C#) called from a third party piece of software via VBScript. The VB script passes an object as a parameter which my application applies changes to.
My C# application dynamically creates a form, which includes controls...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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: 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...
| |