Java Reference
In-Depth Information
The encodeURIComponent() Function
The encodeURIComponent() function has the following signature:
encodeURIComponent(uriComponent)
It is used to replace certain characters in the URI components (values in the URI's
query parts) with escape sequences. For example, an ampersand in the URI component is
escaped as %26. The following code shows how to use this function:
var uriComponent = "Ken&Donna";
var encodedUriComponent = encodeURIComponent(uriComponent);
print("URI Component:", uriComponent);
print("Encoded URI Component:", encodedUriComponent);
URI Component: Ken&Donna
Encoded URI Component: Ken%26Donna
The load( ) and loadWithNewGlobal Functions
The load() and loadWIthNewGlobal() function are used to load and evaluate scripts
stored in a file (locally or remotely) and a script object. Their signatures are:
load(scriptPath)
load(scriptObject)
loadWIthNewGlobal(scriptPath, args1, arg2, ...)
loadWIthNewGlobal(scriptObject, arg1, arg2,...)
Both functions load and evaluate a script. The load() function loads the script in the
same global scope. Existing names in the global scope and the names in the loaded script
may collide and the loaded script may overwrite the existing global values.
The loadWithNewGlobal() function loads the script in a new global scope and the
names in the loaded script will not collide with the already existing names in the global
scope that loads the script. The function lets you pass arguments to the new global scope.
You can specify the arguments after the script path or script object. This way, the existing
global scope can pass information to the new global scope. The passed arguments can be
accessed in the loaded script using the arguments global object. When the loaded script
in the new global scope modifies the built-in global objects, such as String , Object , and
so on, those modification are not available in the caller's global scope.
 
Search WWH ::




Custom Search