Contents

 
Home
ASPRunner Professional 9.0 manual
Prev Page Next Page
 
 

How to access ASP variables

 

Sometimes you need to access ASP variables, such as name of logged user or group to which he belongs, in Javascript. To do this you need to complete the following steps:

1. Proceed to the Visual Editor page and select a page where required variables is initialized (e.g. Login page). Create ASP code snippet and add the following code there:

Response.write "<script>" & _

"window.username = '" & Session("UserID") & "';" & _

"window.group = '" & Session("GroupID") & "';" & _

"</script>"

2. Use new variables (username and group) in Javascript OnLoad event. For example, make a control disabled, if user in not admin:

if (username!='admin')

{

var ctrl = Runner.getControl(pageid, 'Comments');

ctrl.setDisabled();

}

See also

Converted from CHM to HTML with chm2web Standard 2.85 (unicode)