Java Script Functions in JS Header be used in Lotus Script Agent?

Basically, Java script is a client side script which is used in web application. You can use it in verify a form in HTML, you can also use it in anything animation perposes. So obviously you can used Javas cripts in JS header in lotusscript agent.
Put a deeper view below-
Here I will show you how can you run a web agent on any javascript event.
1. You have to generate your desired XML variation. It is a need to use in the agent which using javascript.
2. Now call the agent by using the javascript.
3. As whatever you like to response, use the agent.
Now you can place the two javascript functions in the JS Header of your form-
// Builds the XML variables
that will be sent to the agent.
function BuildXMLVariables()
{
var objDOM = new ActiveXObject
("Microsoft.XMLDOM")
RootEl = objDOM.createNode(1,
"RootElement", "")
objDOM.documentElement = RootEl
// add as many of these nodes as
you need.
// these variables will be accessible
via the agent.
objHeaders = objDOM.createNode
(1, "DocID", "")
objHeaders.text = document.all.
DocumentID.value
RootEl.appendChild(objHeaders)
objHeaders