Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1593 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

Javascript

Thread title: Javascript
     
    Thread tools Search this thread Display Modes  
Prev Previous Post   Next Post Next
12-18-2005, 02:50 AM
#1
Sketch is offline Sketch
Sketch's Avatar
Status: Member
Join date: Aug 2005
Location: Melbourne, Australia
Expertise:
Software:
 
Posts: 419
iTrader: 0 / 0%
 

Sketch is on a distinguished road

  Old  Javascript

I have a validation section in some of my code. It's pretty simple, but the problem is there is 10 sections to it. I don't want to have to write out all 10 sections, I just want to write out one and get a loop to do the rest.

Is there any way to do this?

Code:
			if(document.RealEstate.INSPECTION_TIME_D1.value != "----") {
			
					alert("Error!\nYou have started Inspection #1 but you have not completed it.");
					return false;
				}			
			}
I want something like

Code:
for(x = 0; x !=; x++) {
if(document.RealEstate.INSPECTION_TIME_D+x+.value != "----") {
			
					alert("Error!\nYou have started Inspection #" + x + "but you have not completed it.");
					return false;
				}			
			}
}
Notice in the if statement, the INSPECTION_TIME_D is +x+ not 1. I want the X to replace the number.

I hope this makes sense, I'm sure its easy to do I'm just not sure how to do it.

     


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed