?? arrays.zhtml
字號:
<!-- This file shows how to use array variables in ZHTML scripting. See
the tags in the <FORM> ... </FORM> section. -->
<HTML>
<HEAD>
<TITLE>Array Variables</TITLE>
</HEAD>
<BODY>
<H1>Array Variables</H1>
<FORM ACTION="/index.zhtml" METHOD="POST">
<TABLE>
<!-- The following rows in the table are for the array1[] variable. Note that
the for loop allows you to iterate over the array elements. The count()
function returns the number of elements for the ith array bound (for a
uni-dimensional array, this will always be 0). -->
<?z for ($A = 0; $A < count($array1, 0); $A++) { ?>
<TR>
<!-- Note that the $A loop variable can be used in echo() -->
<TD>array1[<?z echo($A) ?>]
<?z if (error($array1[$A])) { ?>
(ERROR!)
<?z } ?>
</TD>
<TD>
<!-- The varname() function does the proper encoding on a variable name
(as well as loop variable substitution) that is necessary for array
variables. This is needed because the '[' and ']' symbols cannot be
passed verbatim by the web browser. -->
<INPUT TYPE="text" NAME="<?z varname($array1[$A]) ?>" SIZE="5"
VALUE="<?z echo($array1[$A]) ?>">
</TD>
</TR>
<?z } ?>
<!-- The following rows handle the array2[][] variable. Note that for loops
can be nested to handle multidimensional arrays. -->
<?z for ($A = 0; $A < count($array2, 0); $A++) { ?>
<?z for ($B = 0; $B < count($array2, 1); $B++) { ?>
<TR>
<TD>array2[<?z echo($A) ?>][<?z echo($B) ?>]
<?z if (error($array2[$A][$B])) { ?>
(ERROR!)
<?z } ?>
</TD>
<TD>
<INPUT TYPE="text" NAME="<?z varname($array2[$A][$B]) ?>" SIZE="5"
VALUE="<?z echo($array2[$A][$B]) ?>">
</TD>
</TR>
<?z } ?>
<?z } ?>
<!-- The following rows handle the array3[] variable. -->
<?z for ($A = 0; $A < count($array3, 0); $A++) { ?>
<TR>
<TD>array3[<?z echo($A) ?>]
<?z if (error($array3[$A])) { ?>
(ERROR!)
<?z } ?>
</TD>
<TD>
<INPUT TYPE="text" NAME="<?z varname($array3[$A]) ?>" SIZE="5"
VALUE="<?z echo($array3[$A]) ?>">
</TD>
</TR>
<?z } ?>
</TABLE>
<P>
<INPUT TYPE="submit" VALUE="Submit">
<INPUT TYPE="reset" VALUE="Reset">
</FORM>
</BODY>
</HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -