If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > how to pass a javascript variable to asp and vice versa

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-20-04, 05:06
Mini Nair Mini Nair is offline
Registered User
 
Join Date: Feb 2004
Posts: 12
how to pass a javascript variable to asp and vice versa

hi again !!!
can anyone please tell me how to pass an asp variable to javascript...actually the problem i m facing is depending on the value of that flag..i need to display the next asp page....
for eg..if flag=1 i need to display page1.asp
and if flag=2, display page2.asp

how do i do this in asp ??? is there some another way out other than javascripting ???????
Reply With Quote
  #2 (permalink)  
Old 03-20-04, 15:28
MrWizard MrWizard is offline
Registered User
 
Join Date: Mar 2003
Location: Atlanta, GA
Posts: 191
Re: how to pass a javascript variable to asp and vice versa

JavaScript is client side script, ASP is Server side script. ALL ASP is processed before your page is ever sent to the browser.

To put an ASP variable into JavaScript, simply add <%=yourvariable%> into the JavaScript wherever you need it to appear. Since the ASP is processes first, your javaScript will have the ASP variable inserted into it before sending the html to your browser.

Passing a variable from javascript into ASP is by definition an impossible thing, since all the ASP is already processed before the page is rendered. You CAN use javascript to call a new ASP page, passing javascript variables as querystring or form variables.

Tim
__________________
Tim
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On