Function used to establish a pointer to a form.
JSV_formPointer(expV)
n/a
The formPointer function returns a pointer to the passed form specification.
The formPointer function uses the following argument.
Argument | Description |
expV |
The variant can be either a string that defines the form reference
or a form reference.
String Examples
|
The purpose of this function is to reduce the amount of code in a function to when dealing with form pointers. formPointer reduces tha amount of code in each function that uses it by allowing the programmer to pass either a string or the form pointer itself and not be concern about which is being passed.
n/a
The following lines of code
<FORM ACTION="formPointer.htm" NAME="PointerTest" onSubmit="return false;">
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR VALIGN="middle">
<TD ALIGN="right"><B>Movie Title #1:</B></TD>
<TD ALIGN="left"><INPUT TYPE="text" NAME="Field1" VALUE="" SIZE="32" MAXLENGTH="124"></TD>
</TR>
<TR>
<TD ALIGN="right"><B>Movie Title #2:</B></TD>
<TD ALIGN="left"><INPUT TYPE="text" NAME="Field2" VALUE="" SIZE="32" MAXLENGTH="124"></TD>
</TR>
</TABLE>
<BR>
<INPUT TYPE="button" VALUE=" this.form Test " onClick="testArg(this.form, 'ALERT');">
</FORM>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
function testArg(formObj, displayMethod) {
with ( JSV_formPointer(formObj) ) {
if (displayMethod == "ALERT") alert(Field1.value);
else document.write( Field2.value + "<BR><BR>" );
}
}
function initializeFormFields() {
with ( JSV_formPointer("document.PointerTest") ) {
Field1.value = "Galaxy Quest";
Field2.value = "Men in Black";
}
}
initializeFormFields();
document.write( "document.forms[0].name (reference): " );
testArg(document.forms[0].name);
document.write( "document.PointerTest (string): " );
testArg("document.PointerTest");
document.write( "document.forms[0] (reference): " );
testArg(document.forms[0]);
document.write( "document.forms[0] (string): " );
testArg("document.forms[0]");
</SCRIPT>
produce
Copyright © 2000 Roaring Fork Software. All rights reserved.