![]() |
|
|
|
| ||||||
|
Welcome to the The ProgrammersTalk Community forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| Tags: |
![]() |
![]() | | LinkBack | Thread Tools | Display Modes | ![]() |
| |||
| [SOLVED] How to call a ASP program form within javascript? Have a button, and on onClick event, call a javascript function, inside javascript function, what to call a ASP program. Does anyone know how to do it? what is syntax? Thanks I already have reset and submit button defined for different actions, so I have added the third button, I want to redirect to a ASP page when this third button get clicked. |
| |
| |||
| ASP is server-side scripting while JavaScript is client-side, so there really isn't a way exactly to call ASP on with an onclick trigger because the page has already been drawn and is static. however, a work-around could be to have a form who's action is set to an ASP page and then using the following line from javascript you could submit the form that calls the ASP. even if you did a post back to yourself you at least give the server-side scripting a chance to execute as it re-drew the page. EXAMPLE: <% if request.servervariables( "request_method" ) = "POST" then 'the request_method is a great way to detect if you're 'being posted to or drawing the page for the first time end if %> <html> <head> <script language=javascript> function callASP() { document.myform.submit(); } </script> </head> <body> <form name=myform action=mypage.asp method=post> <input type=text name=yourMiscTextFields> <input type=button onclick=javascript:callASP();> </form> </body> </html> hope this helps! good luck! ***JUST SAW YOUR UPDATE*** you could program your third button as follows: <input type=button value=Click-Me onclick= javascript:window.navigate( 'pagename.asp' );> |
![]() |
| Thread Tools | |
| Display Modes | |
| |