[thelist] Different forms to the same script

Scott Dexter sgd at ti3.com
Tue, 30 Nov 1999 10:18:35 -0600


you've got multiple forms, right? they're all named 'TimeSheet.' This
equates to an array of forms, so document.timesheet is ambiguous, you have
to find which document.timesheet you're wanting --make sense? In other
words, you have document.TimeSheet[x] where x is the number(-1) of forms you
have on the page.

You could also pass the reference to the right TimeSheet in your function
call:

function SplitTime(theForm){
theForm.start1.value ....

in the HTML: onChange="SplitTime(this.form);"

Also, I'd question your use of multiple forms --from this code it doesn't
look like there's any benefit. Is there a reason you don't use one form?

sgd
--
think safely

> -----Original Message-----
> From: Minh-Lee Goon [mailto:v7ac@sdsumus.sdstate.edu]
> Sent: Tuesday, November 30, 1999 9:59 AM
> To: thelist@lists.evolt.org
> Subject: Re: [thelist] Different forms to the same script
> 
> 
> Here's the code. I think if you try it out, you'll figure out 
> what I'm trying to do.
> 
> <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
> 
> <html>
> <head>
> 	<title>Timesheet Calculator</title>
> 
> 	<style type="text/css">
> 	<!-- 
> 		b { color:#0080ff; font-size:20px; }
> 		body { font-family:Arial; }
> 		input { font-size:14px; font-family:"Courier 
> New"; text-align:right; }
> 
> 		.red { color:#800040; font-size:22px; font-weight:800; }
> 	-->
> 	</style>
> 
> 	<script language="JavaScript" type="text/javascript">
> 	<!--
> 	function splitTime() {
> 		Total_Duration = 0;
> 		
> 		Start_Time_1 = document.TimeSheet.start1.value;