473,387 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

HTML forms and javascript

hi,
i have just started learning web development. i m trying to make a simple calender web application using HTML and JAVASCRIPT. i want that all months are displayed in a drop-down list. when user selects any month from this list and clicks the OK button, the calender of selected month should be displayed below that drop-down list. now my requirement is that i have to write code for calender table as well as the form code in Javascript. when i tried to use the form tag in script tag in header, it gave a run-time error. i dont know how to solve this problem. can anyone plz help me !!!!
Mar 18 '07 #1
9 1372
hi,
i have just started learning web development. i m trying to make a simple calender web application using HTML and JAVASCRIPT. i want that all months are displayed in a drop-down list. when user selects any month from this list and clicks the OK button, the calender of selected month should be displayed below that drop-down list. now my requirement is that i have to write code for calender table as well as the form code in Javascript. when i tried to use the form tag in script tag in header, it gave a run-time error. i dont know how to solve this problem. can anyone plz help me !!!!
Mar 19 '07 #2
r035198x
13,262 8TB
hi,
i have just started learning web development. i m trying to make a simple calender web application using HTML and JAVASCRIPT. i want that all months are displayed in a drop-down list. when user selects any month from this list and clicks the OK button, the calender of selected month should be displayed below that drop-down list. now my requirement is that i have to write code for calender table as well as the form code in Javascript. when i tried to use the form tag in script tag in header, it gave a run-time error. i dont know how to solve this problem. can anyone plz help me !!!!
What error did you get which code did you use?
Mar 19 '07 #3
What error did you get which code did you use?

i m presenting the entire code for ur kind consideration.




[HTML] <html>

<head>
<meta http-equiv="Content-Language" content="sv">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>2007</title>

<script language="javascript">


function abc()
{
document.write('<form name=\"f1\" action=\"--WEBBOT-SELF--\" method=\"POST\">');



<!--webbot bot="SaveResults" u-file="C:\Documents and Settings\Mahmood\Desktop\MONTHS\_private\form_resu lts.csv" s-format="TEXT/CSV" s-label-fields="TRUE" --><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";

var a="<p align=center>";

a+="<select size=1 name=\"D1\">";
a+="<option selected value=1>January</option>";
a+="<option value=2>February</option>";
a+="<option value=3>March</option>";
a+="<option value=4>April</option>";
a+="<option value=5>May</option>";
a+="<option value=6>June</option>";
a+="<option value=7>July</option>";
a+="<option value=8>August</option>";
a+="<option value=9>September</option>";
a+="<option value=10>October</option>";
a+="<option value=11>November</option>";
a+="<option value=12>December</option>";
a+="</select>&nbsp; <b><font size=4>2007&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
a+="<input type=button name=ok value=OK onClick=go()>";


a+="</font></b>";

a+="</p>";
document.write('</form>');

document.write(a);

}




function go()
{
abc();

if(f1.D1.value==1)
{

var w="<table border=1 width=100%>";
w+="<tr>";
w+="<td width=12% align=center><b><font size=4>Sunday</font></b></td>";
w+="<td width=12% align=center><b><font size=4>Monday</font></b></td>";
w+="<td width=12% align=center><b><font size=4>Tuesday</font></b></td>";
w+="<td width=12% align=center><b><font size=4>Wednesday</font></b></td>";
w+="<td width=13% align=center><b><font size=4>Thursday</font></b></td>";
w+="<td width=13% align=center><b><font size=4>Friday</font></b></td>";
w+="<td width=13% align=center><b><font size=4>Saturday</font></b></td>";
w+="</tr>";
w+="</table>";
document.write(w);
}
else

if(f1.D1.value==2)
{
var w="<table border=1 width=100%>";
w+="<tr>";
w+="<td width=12% align=center><b><font size=4>Sunday</font></b></td>";
w+="<td width=12% align=center><b><font size=4>Monday</font></b></td>";
w+="<td width=12% align=center><b><font size=4>Tuesday</font></b></td>";
w+="<td width=12% align=center><b><font size=4>Wednesday</font></b></td>";
w+="<td width=13% align=center><b><font size=4>Thursday</font></b></td>";
w+="<td width=13% align=center><b><font size=4>Friday</font></b></td>";
w+="<td width=13% align=center><b><font size=4>Saturday</font></b></td>";
w+="</tr>";


w+="</table>";

document.write(w);
}

else
if(f1.D1.value==3)
{
var w="<table border=1 width=100%>";
w+="<tr>";
w+="<td width=12% align=center><b><font size=4>Sunday</font></b></td>";
w+="<td width=12% align=center><b><font size=4>Monday</font></b></td>";
w+="<td width=12% align=center><b><font size=4>Tuesday</font></b></td>";
w+="<td width=12% align=center><b><font size=4>Wednesday</font></b></td>";
w+="<td width=13% align=center><b><font size=4>Thursday</font></b></td>";
w+="<td width=13% align=center><b><font size=4>Friday</font></b></td>";
w+="<td width=13% align=center><b><font size=4>Saturday</font></b></td>";
w+="</tr>";


w+="</table>";

document.write(w);

}

else
if(f1.D1.value==4)
{
var w="<table border=1 width=100%>";
w+="<tr>";
w+="<td width=12% align=center><b><font size=4>Sunday</font></b></td>";
w+="<td width=12% align=center><b><font size=4>Monday</font></b></td>";
w+="<td width=12% align=center><b><font size=4>Tuesday</font></b></td>";
w+="<td width=12% align=center><b><font size=4>Wednesday</font></b></td>";
w+="<td width=13% align=center><b><font size=4>Thursday</font></b></td>";
w+="<td width=13% align=center><b><font size=4>Friday</font></b></td>";
w+="<td width=13% align=center><b><font size=4>Saturday</font></b></td>";
w+="</tr>";


w+="</table>";

document.write(w);
}

else
if(f1.D1.value==5)
{
var w="<table border=1 width=100%>";
w+="<tr>";
w+="<td width=12% align=center><b><font size=4>Sunday</font></b></td>";
w+="<td width=12% align=center><b><font size=4>Monday</font></b></td>";
w+="<td width=12% align=center><b><font size=4>Tuesday</font></b></td>";
w+="<td width=12% align=center><b><font size=4>Wednesday</font></b></td>";
w+="<td width=13% align=center><b><font size=4>Thursday</font></b></td>";
w+="<td width=13% align=center><b><font size=4>Friday</font></b></td>";
w+="<td width=13% align=center><b><font size=4>Saturday</font></b></td>";
w+="</tr>";


w+="</table>";

document.write(w);
}


else
if(f1.D1.value==6)
{
var w="<table border=1 width=100%>";
w+="<tr>";
w+="<td width=12% align=center><b><font size=4>Sunday</font></b></td>";
w+="<td width=12% align=center><b><font size=4>Monday</font></b></td>";
w+="<td width=12% align=center><b><font size=4>Tuesday</font></b></td>";
w+="<td width=12% align=center><b><font size=4>Wednesday</font></b></td>";
w+="<td width=13% align=center><b><font size=4>Thursday</font></b></td>";
w+="<td width=13% align=center><b><font size=4>Friday</font></b></td>";
w+="<td width=13% align=center><b><font size=4>Saturday</font></b></td>";
w+="</tr>";


w+="</table>";

document.write(w);
}



}

</script>





</head>


<body onload=abc()>

</body>

</html>
[/HTML]



could u plz point out my mistakes and if possible give me the correct code...
Mar 19 '07 #4
acoder
16,027 Expert Mod 8TB
Post your code please. What error are you getting?
Mar 19 '07 #5
acoder
16,027 Expert Mod 8TB
Threads merged.
Mar 19 '07 #6
Threads merged.

threads merged???? sorry unable to understand !!
how this problem can be solved?
Mar 19 '07 #7
acoder
16,027 Expert Mod 8TB
threads merged???? sorry unable to understand !!
how this problem can be solved?
Sorry about that. You double-posted on the same topic, so I merged the threads together.

As for your problem, in your code, you have closed the form tag before writing the select dropdown. Why are you calling abc() every time you click on the go button? That will create duplicate forms.
Mar 20 '07 #8
i called abc() function repeatedly bcoz i want that the calender of the user's selected month should be displayed UNDER this drop-down list. and if user wants to make any selection from this list again,he/she does not have to press BACK button to go to this drop-down list.
even if i don't call the abc function repeatedly and close the form tag after writing the drop-down list, i m still getting the same error of "object required" as i click the OK button.
Mar 20 '07 #9
acoder
16,027 Expert Mod 8TB
Instead of f1.d1, try:
Expand|Select|Wrap|Line Numbers
  1. document.f1.d1
Mar 21 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Bob Nolty | last post by:
Hi all -- I'm trying to create a hidden form in the document using only Javascript -- I don't know what form I want until the user clicks a button -- I tried the following code, which does...
4
by: VK | last post by:
09/30/03 Phil Powell posted his "Radio buttons do not appear checked" question. This question led to a long discussion about the naming rules applying to variables, objects, methods and properties...
12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
2
by: dsnyder | last post by:
This HTML has a bit of Javascript at the end that puts the initial focus on the userID field. It works great on Windows2000 running IE6, but the initial focus never goes to the userID field on...
6
by: Vanitha | last post by:
Hi All, I am developing a Web based application for an embedded target, using BOA webserver. I need to return some values to the HTML client. I am using CGI-C to extract the values sent by...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
4
by: Sathyaish | last post by:
I am no JavaScript progammer, and unfortunately am having to babysit an old code base that has a lot of JavaScript in it. I have two questions: (1) Can two HTML controls have the same name? It...
8
by: Thaqalainnaqvi | last post by:
Several times I logged-in successfully but after log-in I can't use features/services which were shown prior to my login. Can anyone exoert from this forum check , is it technical fault of Bank...
2
by: robkiolbasa | last post by:
Hello, I am stumped on how to set a form field value to a value in a different form. It seems like something that should be pretty easy. Basic example below: <form name = "form1" action =...
1
by: since | last post by:
I figured I would post my solution to the following. Resizable column tables. Search and replace values in a table. (IE only) Scrollable tables. Sortable tables. It is based on a lot...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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...
0
Oralloy
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.