PDA

View Full Version : JS not functioning



dan-dan
25 Aug 2009, 10:40 AM
Hi, I'm Danny and new here. Please be gentle lol.

I'm trying to create a user-face at work for normal day-to-day activities. I've just started a little section for estimate forms. I can't seem to get the javascript to function whatsoever, despite it being stupidly simple. Please could someone help me out. I'm currently working on the date (top) and reset (bottom).
Excuse my lack of css, but this was just a quick trial run.
Here's the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">


<head>
<title>Estimate Form</title>



<script language="javascript" type="text/javascript">

function datenow() {
var date = getDate();
var month = getMonth();
var year = getYear();

document.est_form.name.value= date + month + year;
}

</script>


<link rel="stylesheet" href="pages.css" type="text/css" media="screen" />

<style type="text/css">

#est {
text-align:center;
}

tr:hover {
background:#FFFBC6;
}
</style>

</head>

<body>

<h2 id="est">Estimate Request Form</h2>

<form name="est_form" action="">

<table align="center">
<tr>
<td>Enquiry Date</td>
<td><input type="text" size="auto" value="" name="date" readonly="readonly" />
<input type="button" name="date" value="Get Date" onclick="datenow()" /></td>
</tr>

<tr>
<td>Title</td>
<td>
<select name="title">
<option value="none" selected="selected"></option>
<option value="mr">Mr</option>
<option value="mrs">Mrs</option>
<option value="miss">Miss</option>
</select></td>
</tr>

<tr>
<td>First Name</td>
<td><input type="text" size="40" value="" name="date" /></td>
</tr>

<tr>
<td>Surname</td>
<td><input type="text" size="40" value="" name="date" /></td>
</tr>

<tr>
<td>Company (If Applicable)</td>
<td><input type="text" size="40" value="" name="date" /></td>
</tr>

<tr>
<td valign="top">Address</td>
<td><input type="text" size="40" value="" name="date" /><br />
<input type="text" size="40" value="" name="date" /><br />
<input type="text" size="40" value="" name="date" /></td>
</tr>

<tr>
<td>Post Code</td>
<td><input type="text" size="40" value="" name="date" /></td>
</tr>

<tr>
<td valign="top">Site Address If Different</td>
<td><input type="text" size="40" value="" name="date" /><br />
<input type="text" size="40" value="" name="date" /><br />
<input type="text" size="40" value="" name="date" /></td>
</tr>

<tr>
<td>Post Code</td>
<td><input type="text" size="40" value="" name="date" /></td>
</tr>

<tr>
<td>E-Mail Address</td>
<td><input type="text" size="40" value="" name="date" /></td>
</tr>

<tr>
<td>Office/Day/Site</td>
<td><input type="text" size="40" value="" name="date" /></td>
</tr>

<tr>
<td>Home/Evening</td>
<td><input type="text" size="40" value="" name="date" /></td>
</tr>

<tr>
<td>Mobile</td>
<td><input type="text" size="40" value="" name="date" /></td>
</tr>

<tr>
<td>Directions (If Applicable)</td>
<td><input type="text" size="40" value="" name="date" /></td>
</tr>

<tr>
<td>Nature of Enquiry (Brief Description)</td>
<td><input type="text" size="40" value="" name="date" /></td>
</tr>

<tr>
<td>Appointment Date</td>
<td>
<select name="day">
<option value="none" selected="selected"></option>
<option value="mon">Mon</option>
<option value="tue">Tue</option>
<option value="wed">Wed</option>
<option value="thur">Thurs</option>
<option value="fri">Fri</option>
</select>
<select name="date">
<option value="none" selected="selected"></option><option value="1">1</option><option value="2">2</option>
<option value="3">3</option><option value="4">4</option><option value="5">5</option>
<option value="6">6</option><option value="7">7</option><option value="8">8</option>
<option value="9">9</option><option value="10">10</option><option value="11">11</option>
<option value="12">12</option><option value="13">13</option><option value="14">14</option>
<option value="15">15</option><option value="16">16</option><option value="17">17</option>
<option value="18">18</option><option value="19">19</option><option value="20">20</option>
<option value="21">21</option><option value="22">22</option><option value="23">23</option>
<option value="24">24</option><option value="25">25</option><option value="26">26</option>
<option value="27">27</option><option value="28">28</option><option value="29">29</option>
<option value="30">30</option><option value="31">31</option>
</select>
<select name="month">
<option value="none" selected="selected"></option>
<option value="jan">Jan</option><option value="feb">Feb</option><option value="mar">Mar</option>
<option value="apr">Apr</option><option value="may">May</option><option value="jun">Jun</option>
<option value="july">July</option><option value="aug">Aug</option><option value="sep">Sep</option>
<option value="oct">Oct</option><option value="nov">Nov</option><option value="dec">Dec</option>
</select>
</td>
</tr>

<tr>
<td>Appointment Time</td>
<td>
<select name="hour">
<option value="none" selected="selected"></option>
<option value="1">1</option><option value="2">2</option><option value="3">3</option>
<option value="4">4</option><option value="5">5</option><option value="6">6</option>
<option value="7">7</option><option value="8">8</option><option value="9">9</option>
<option value="10">10</option><option value="11">11</option><option value="12">12</option>
</select>
<select name="minutes">
<option value="none" selected="selected"></option>
<option value="00">00</option><option value="15">15</option><option value="30">30</option>
<option value="45">45</option>
</select>
<select name="ampm">
<option value="none" selected="selected"></option>
<option value="am">AM</option><option value="pm">PM</option>
</select>
</td>
</tr>

<tr>
<td></td>
<td align="center"><input type="button" name="submit" value="Submit" onclick="sub_est()" />
<input type="button" name="reset" value="Reset" onclick="document.est_form.reset()" /></td>
</tr>

</table>

</form>

</body>
</html>