SUBROUTINE TAG_A
INCLUDE #RW.INCLUDE.DEFS FROM /SYSFILES/REALWEB,BP
EQU LF TO CHAR(10)
CALL RW_START_HTML_PAGE("RWA_TAG Example", "", "", "", "")
HTML = ""
CALL RW_START_PARA("", "")
CALL RW_PUT("The following example shows how to check that a " : ...
"function is invoked with the correct number of " : ...
"parameters, since JavaScript doesn't do this for you:")
CALL RW_END_PARA
CALL RW_FIXED_ON
CALL RW_PUT("function f(x, y, z) {" : LF)
CODE = " "
CMT = "// First check that the right number of parameters were passed."
CALL RWA_TAG(CODE, "span", CMT, 'style="color: green"')
CALL RW_PUT(CODE : " if (arguments.length != 3) {" : LF : ...
" alert('function f called with ' + arguments.length + " : LF : ...
" 'parameters - 3 parameters expected.');" : LF : ...
" return null;" : LF : ...
" }" : LF)
CODE = " "
CMT = "// Now do the actual function..."
CALL RWA_TAG(CODE, "span", CMT, 'style="color: green"')
CALL RW_PUT(CODE : "}")
CALL RW_FIXED_OFF
CALL RW_END_PAGE
RETURN
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<META NAME="Generator" CONTENT="Reality">
<TITLE>RWA_TAG Example</TITLE>
</HEAD>
<BODY>
<P>
The following example shows how to check that a function is invoked with the correct number of parameters, since JavaScript doesn't do this for you:
</P>
<PRE>function f(x, y, z) {
<span style="color: green">// First check that the right number of parameters were passed.</span>
if (arguments.length != 3) {
alert('function f called with ' + arguments.length +
'parameters - 3 parameters expected.');
return null;
}
<span style="color: green">// Now do the actual function...</span>
}</PRE>
</BODY>
</HTML>
NEC welcomes your feedback on our documentation.
If you have any comments about the current Reality Help, or want something to be added in a future revision, please contact your NEC Helpdesk.
If your comment relates to this particular Help topic, remember to include the following information:
|
Product:
|
RealityVersion 15.6
|
|
Help revision:
|
Revision 0
|
|
Help topic:
|
RWA_TAG Example (RealWeb)
|
|
File name:
|
TAG_A.htm
|