I want to add a button to an asp page. The scenario is:
If name returned from above function = 'abc' Then sh开发者_StackOverflowow button on button click call function 'A' Else End if
Can anyone help me in adding this button and calling the function in the code. I have least knowledge of asp .
You can make two classic asp files called submission.asp and process_submission.asp (you can make one file, but I'll use two in this example). In submission.asp, call your GetName() function and show the button if GetName() is "abc". If the user clicks your submit button, the request is sent to the process_submission.asp file. In that file, make a function called "CallFunctionA" and execute that function if the Request("Action") = "CallFunctionA".
submission.asp:
<form name="frmSubmissionForm" action="process_submission.asp">
<%
Dim FunctionResult
FunctionResult = GetName()
if FunctionResult = "abc" then
%>
<input type="submit" name="Submit" value="Submit" />
<input type="hidden" name="Action" value="CallFunctionA" />
<%
end if
' Sample Function
Function GetName()
GetName = "abc"
End Function
%>
</form>
process_submission.asp:
<%
Dim Result
if Request("Action") = "CallFunctionA" then
Result = CallFuctionA()
end if
Response.Write Result
' Sample Function
Function CallFuctionA()
CallFuctionA = "Hello World"
End Function
%>
精彩评论