Email:info@beework.net
Sales:
0800 882 4173
Support:
0117 230 7000
Mobile:
07866 627185
International:
+44 (0)117 230 7000
Ready Made Solutions
Photographer website
Estate & letting agents
Events & ticket sales
Charities
Church website
Wedding day
Holiday let website
Bookmark with
Generates JavaScript for do loop code. Specify the number of times to create the loop and click Generate Code.
for ([initial-expression]; [condition]; [increment-expression]) {
statements
}When a for loop executes, the following occurs: <SCRIPT>
function howMany(selectObject) {
var numberSelected=0
for (var i=0; i < selectObject.options.length; i++) {
if (selectObject.options[i].selected==true)
numberSelected++
}
return numberSelected
}
</SCRIPT>
<FORM NAME="selectForm">
<P><B>Choose some music types, then click the button below:</B>
<BR><SELECT NAME="musicTypes" MULTIPLE>
<OPTION SELECTED> R&B
<OPTION> Jazz
<OPTION> Blues
<OPTION> New Age
<OPTION> Classical
<OPTION> Opera
</SELECT>
<P><INPUT TYPE="button" VALUE="How many are selected?"
onClick="alert ('Number of options selected: '
+ howMany(document.selectForm.musicTypes))">
</FORM>