We often, need to pass variables declared in ASP to JavaScript code. This can be accomplished by following ways

  1. By declaring a hidden input type.

We can declare hidden input type as follows to store values retrieved from ASP.

<input type=hidden name=invno value="<%=Request("invnum")%>">

 

Then, while submitting the form through JavaScript, we can use hidden input name as follows.

 

document.frm1.action = 'PLProcess.asp?InvNum=' + document.frm1.invno.value;

document.frm1.submit();

 

   2.  By changing the location of document , which is possible for pop up windows.

opener.document.location='PLProcess.asp? InvNum =<%=invno%>&status="A"&ConfirmFlg="N"';

 

Here, invno is a variable defined in ASP in same page.

 

 

0 comments: