calling function from onclick

C

Curtis

Sorry if this is the wrong newsgroup in which to post.

We have an asp page on a webserver supporting asp pages.

How can we run/call a function on this page using an onclick or other event
from a control. For example, when an image is clicked or a combobox is
changed. We know how to run a javascript, but would be nice to run an asp
function.

Thanks.
 
E

Evertjan.

Curtis wrote on 20 nov 2004 in microsoft.public.inetserver.asp.general:
Sorry if this is the wrong newsgroup in which to post.

We have an asp page on a webserver supporting asp pages.

How can we run/call a function on this page using an onclick or other
event from a control. For example, when an image is clicked or a
combobox is changed. We know how to run a javascript, but would be
nice to run an asp function.

Impossible!

ASP runs on the server BEFORE the page is submitted to the client.

The only way to execute a server function [that btw can be written in
javascript] is to send a request [for a new/same page] to the server.

========== test.asp ===========

<script runat=server language=javascript>
response.write( request.querystring('x') );
</script>

<br>
<button onclick="location.href='test.asp?x=Hello%20world'">
Write 'Hello world' above this button
</button>

================================

ASP is not a language but a server platform for script languages,
like j[ava]script and vbscript.
 
D

dlbjr

I use the following code in my clientside JavaScript to make calls back to the server.
I call asp pages with querystring data.
This allows me to save, retrieve, and delete data without submitting the page.

function ProcessURL(strURL) {
var XMLHTTP;
var strResult;
document.body.style.cursor='wait';
XMLHTTP = new ActiveXObject( "Microsoft.XMLHTTP" );
XMLHTTP.open( "GET", strURL, false );
XMLHTTP.send();
document.body.style.cursor='auto';
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,163
Messages
2,570,897
Members
47,434
Latest member
TobiasLoan

Latest Threads

Top