Active Server Pages

Moderators: None (Apply to moderate this forum)
Number of threads: 1763
Number of posts: 4498

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Execute function when button is clicked Posted by TheB18 on 27 Sept 2003 at 7:27 AM
<%
Response.Write("<p><input type=button value=SomeButton name=Button1></p>")

Function DoSome()
Response.Write("Function executed!")
End Function
%>

How can I execute the DoSome function when Button1 is pressed?
Report
Re: Execute function when button is clicked Posted by tbfromny on 27 Sept 2003 at 3:33 PM
: <%
: Response.Write("<p><input type=button value=SomeButton name=Button1></p>")
:
: Function DoSome()
: Response.Write("Function executed!")
: End Function
: %>
:
: How can I execute the DoSome function when Button1 is pressed?
:

You can't, at least not without reloading something from the server.

Remember how ASP works:

1. Client requests page from server
2. Sever reads ASP page, notices that it _is_ an ASP page, executes code inside <% %> tags.
3. Resulting HTML send to client.

All of the processing of VBScript happens _before_ the page is sent to the client. The only real way you're going to be able to have the client's machine execute any sort of code (without going through the server) is to write it up as Javascript.

That said, there's a lot you can do in Javascript. If you have a specific (small) example of what you're trying to do, that might help.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.