Forums

ASP

This topic is locked

need help with onclick

Posted 09 May 2007 06:13:17
1
has voted
09 May 2007 06:13:17 mike lafferty posted:
here is my sub:
<%
sub onclick_gameson()

Dim filename, fs, f
filename = "flag.txt"
Set fs=Server.CreateObject("Scripting.FileSystemObject"
set f=fs.OpenTextFile(Server.MapPath("Documents/flag.txt", 2, True)
f.write("1"
f.close
Set f=nothing
Set fs=nothing

end sub
%>

and here is how im calling it:
<FORM>
<TABLE BORDER CELLPADDING=3>
<TR>
<TD><INPUT TYPE=BUTTON OnClick="gameson()" VALUE="Games On!"></TD>
<TD><INPUT TYPE=BUTTON OnClick="gamesoff()" VALUE="Games Cancelled!"></TD>
</TR>
</TABLE>
</FORM>

basically what i need is a button that can be clicked so that the sub will be run
if anyone can help me please!!!
thank you in advance!!

Replies

Replied 09 May 2007 14:51:35
09 May 2007 14:51:35 Prabhjot Kang replied:
HI Mike

I am not an expert in IT but as far as my knowledge goes what u re trying to do here is call an asp (server side) procedure on click of a button.

I think what you can do here is write the code of sub on an another page , name it as gameson.asp and submit you button page to this new page and after teh processing just redirect it back to same page containing the buttons.

That way you can display whatever results you wana display.

Thanks
Replied 09 May 2007 21:36:12
09 May 2007 21:36:12 mike lafferty replied:
thanks alot!!! works great!!
Replied 10 May 2007 07:26:31
10 May 2007 07:26:31 Prabhjot Kang replied:
My pleasure

Reply to this topic