Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > selection structure nested within another selection structure

Reply
Thread Tools

selection structure nested within another selection structure

 
 
4Ankit@gmail.com
Guest
Posts: n/a
 
      12-07-2006
Hey guys i am having some trouble with nesting one selection structure
within another selection structure. At the moment i am unclear what
selection structures are and just need a simple example of a selection
structure within another selection structure. I am supposed to use
function definitions with parameters to validate a form. my code for
what i have done so far is as follows(cropped):


function mainFunction() {
var dateFormat = (document.dateFormat.date.value + " " +
document.dateFormat.month.value + ", " +
document.dateFormat.year.value);
window.alert("The date is " + dateFormat);}
return; }

function checkDate( ) {
if (0<parseInt(document.dateFormat.date.value) &&
parseInt(document.dateFormat.date.value)<=31) {
return true;}
else {window.alert("Problem with the date");
return false;} }

Basically how can i change the above checkDate function in include a
selection structure nested within another selection
structure.Eventually i will have another 2 functions which will b used
to validate the year and month the user enters. Your help would be
great
Have a nice day

 
Reply With Quote
 
 
 
 
ASM
Guest
Posts: n/a
 
      12-07-2006
a écrit :
> Basically how can i change the above checkDate function in include a
> selection structure nested within another selection
> structure.Eventually i will have another 2 functions which will b used
> to validate the year and month the user enters.


function checkDate( whatForm ) {
var v = document.forms[whatForm].date.value
if (0<=v && parseInt(v)<=31) return true;
else {
window.alert("Problem with the date");
v.focus();
return false;
}
}

function checkMonth( whatForm ) {
var v = document.forms[whatForm].month.value
if (0<=v && parseInt(v)<=12) return true;
else {
window.alert("Problem with the month");
v.focus();
return false;
}
}
function checkYear( whatForm ) {
var v = ... etc ...
}

function mainFunction( whatForm ) {
checkDat(whatForm);
checkMonth(whatForm);
checkYear(whatForm);
var dateFormat = (d ... etc ...
}


--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dealing with nested xml within nested xml within...... Ultrus Python 3 07-09-2007 09:00 PM
Allocating memory to nested Structures within a Structure Amit_Basnak C++ 3 05-26-2007 08:24 AM
JTable with row selection, but no cell selection Simon Niederberger Java 2 01-07-2005 04:17 PM
JS comparing innerHTML to text selection (window.getSelection() /document.selection) Andrew Crowe HTML 1 09-13-2004 02:22 PM
Editing a datagrid nested within another datagrid uk00121 ASP .Net Datagrid Control 2 04-19-2004 02:17 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57