📄 web.zhtml
字号:
<!-- This file shows how to display and access variables in ZHTML scripting.
See the tags in the <FORM> ... </FORM> section. -->
<HTML>
<HEAD>
<TITLE>Web Variables</TITLE>
</HEAD>
<BODY>
<H1>Web Variables</H1>
<FORM ACTION="/index.zhtml" METHOD="POST">
<TABLE>
<!-- The following row in the table is for the my_string variable -->
<TR>
<TD>my_string
<!-- Print out and error indicator if $my_string is in error. Note that this
will only happen if the user has just submitted a value that did not
pass the guard expression (or, in this case, the implicit string length
limitations). -->
<?z if (error($my_string)) { ?>
(ERROR!)
<?z } ?>
</TD>
<TD>
<!-- The INPUT tag below sets up the input field for the my_string value.
Note the echo() ZHTML tag below, which outputs the current value of the
variable. -->
<INPUT TYPE="text" NAME="my_string" SIZE=20 VALUE="<?z echo($my_string) ?>">
</TD>
</TR>
<!-- The following row in the table is for the inum variable -->
<TR>
<TD>inum
<?z if (error($inum)) { ?>
(ERROR!)
<?z } ?>
</TD>
<TD>
<!-- The print() statement below is a synonym for the echo() statement. -->
<INPUT TYPE="text" NAME="inum" SIZE=5 VALUE="<?z print($inum) ?>">
</TD>
</TR>
<!-- The following row in the table is for the lnum variable -->
<TR>
<TD>lnum
<?z if (error($lnum)) { ?>
(ERROR!)
<?z } ?>
</TD>
<TD>
<!-- Note that below, the printf() statement is used instead of echo statement.
The first parameter is a printf-style format specifier. Note, however,
that the printf() command is limited to a single variable, unlike the more
general C printf() function. -->
<INPUT TYPE="text" NAME="lnum" SIZE=6 VALUE="<?z printf("%ld", $lnum) ?>">
</TD>
</TR>
<!-- The following row in the table is for the uinum variable -->
<TR>
<TD>uinum
<?z if (error($uinum)) { ?>
(ERROR!)
<?z } ?>
</TD>
<TD>
<INPUT TYPE="text" NAME="uinum" SIZE=5 VALUE="<?z echo($uinum) ?>">
</TD>
</TR>
<!-- The following row in the table is for the character variable -->
<TR>
<TD>character
<?z if (error($character)) { ?>
(ERROR!)
<?z } ?>
</TD>
<TD>
<INPUT TYPE="text" NAME="character" SIZE=1 VALUE="<?z echo($character) ?>">
</TD>
</TR>
<!-- The following row in the table is for the fpoint variable -->
<TR>
<TD>fpoint
<?z if (error($fpoint)) { ?>
(ERROR!)
<?z } ?>
</TD>
<TD>
<!-- Note that below printf() is used to print the value with a specific number
of decimal places. -->
<INPUT TYPE="text" NAME="fpoint" SIZE=5 VALUE="<?z printf("%5.3f", $fpoint) ?>">
</TD>
</TR>
</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 + -