UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Closed TopicStart new topic
> Asp - Using The Same Page And Resubmitting Asp - Vbscript    
 
   
Dave Slater
post May 31 2002, 03:51 AM
Post#1


VIP Emeritus
Posts: 1,644
Joined: 31-January 00
From: Bristol, UK.


Copy all of the code below and name it whatever.asp then change the txtScript constant to whatever you've called it.


<%@ Language=VBScript %>
<%

Const txtScript = "demo.asp"

public function header()
Response.Write "<head>"
Response.Write "<title>ASP Demo</title>"
Response.Write "</head>"
Response.Write "<body>"
Response.Write "<table border=0 width='100%'>"
Response.Write "<tr>"
Response.Write "<td width='100%' align='center'><p align='center'><strong><font face='Arial' Size=5 Color='darkblue'><i>ASP Demo</i></font> </strong></td>"
Response.Write "</tr>"
Response.Write "</table>"
Response.Write "<hr COLOR='Green'>"
End function

public function footer()

Response.Write "<hr COLOR='Green' align='center'>" & vbcrlf

Response.Write "<table border=0 width=""100%"" cellspacing=0 cellpadding=2 height=60>" & vbcrlf
Response.Write "<tr>" & vbcrlf

Response.Write "<td width='100%' align='center' valign='middle' height=54>" & vbcrlf
Response.Write "Author: Dave Slater"
Response.Write "</td>" & vbcrlf

Response.Write "</tr>" & vbcrlf
Response.Write "</table>" & vbcrlf

Response.Write "</center>" & vbcrlf

Response.Write "</body>" & vbcrlf

End function

%>

<HTML>

<%
'Written by David Slater (03/01/2002) as a way to demonstrate how ASP reloads the same page
'and can perform different functions with the same page.

'This is the main page

'Loads the header function at the top.
header()

Response.Write "<h3 align='center'>Select the numbers below.</h3>"

nMode = CLng(Request.QueryString("Mode"))

Select Case nMode
Case 1
Response.Write "<p>You pressed 1</p>" & vbcrlf
'Run function 1 here
Response.Write "<p>Select <a href='" & txtScript & "'>BACK</a> to retry</p>" & vbcrlf

Case 2
Response.Write "<p>You pressed 2</p>" & vbcrlf
'Run function 2 here
Response.Write "<p>Select <a href='" & txtScript & "'>BACK</a> to retry</p>" & vbcrlf

Case 3
Response.Write "<p>You pressed 3</p>" & vbcrlf
'Run function 3 here
Response.Write "<p>Select <a href='" & txtScript & "'>BACK</a> to retry</p>" & vbcrlf

Case 4
Response.Write "<p>You pressed 4</p>" & vbcrlf
'Run function 4 here
Response.Write "<p>Select <a href='" & txtScript & "'>BACK</a> to retry</p>" & vbcrlf

Case 5
Response.Write "<p>You pressed 5</p>" & vbcrlf
'Run function 5 here
Response.Write "<p>Select <a href='" & txtScript & "'>BACK</a> to retry</p>" & vbcrlf

Case 6
Response.Write "<p>You pressed 6</p>" & vbcrlf
'Run function 6 here
Response.Write "<p>Select <a href='" & txtScript & "'>BACK</a> to retry</p>" & vbcrlf

Case Else
Response.Write "<p align='center'>The web page has not been submitted yet.</p>" & vbcrlf

For intI = 1 to 3
Response.Write "<p align='center'><form method='GET' name='test_form" & intI & "' action='" & txtScript & "'>" & vbcrlf
Response.Write "<input type='hidden' name='Mode' value=" & intI & ">" & vbcrlf
Response.Write "<input type='submit' value=" & intI & ">" & vbcrlf
Response.Write "</form></p>" & vbcrlf
Next
For intL = 4 to 6
Response.Write "<p align='center'><a href='" & txtScript & "?Mode=" & intL & "'><b>" & intL & "</b></p>" & vbcrlf
Next

End Select

footer()

%>

</HTML>
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    17th December 2017 - 01:18 AM