View Single Post
  #4 (permalink)  
Old 06-10-2007, 05:14 PM
country bear
Posts: n/a
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' );>

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!