Because javascript is client side and ASP is server side. Both of the ASP functions are going to be executed because the ASP script is evaluated first as if though the javascript does not exist. Client-side technology and Server-side technology are independent. The only way you can mix them is to have ASP write javascript for the client side.
Matthew Small IT Supervisor Showstopper National Dance Competitions 3660 Old Kings Hwy Murrells Inlet, SC 29576 843-357-1847 http://www.showstopperonline.com -----Original Message----- From: Mario Lopes [mailto:santoslopes@;netcabo.pt] Sent: Monday, November 04, 2002 1:29 PM To: ActiveServerPages Subject: I can�t believe Why the folling function executes both asp sub's? <SCRIPT LANGUAGE="Javascript"> <!-- Beginning of JavaScript - function verifica(opcao,certa){ alert(opcao+" "+certa) if (opcao==certa){ Certo() <% contar() %> } else { Errado() <% Descontar() %> } } // - End of JavaScript - --> </SCRIPT> <% sub Descontar() session("pontos")=session("pontos")-session("perdepontos") Set MyConn=Server.CreateObject("ADODB.Connection") MyConn.Open "DSN=esabnet" sqlstmt="update alunos set pontos="&session("pontos") &" where nome='"&session("nome")&"'" Set MyRs=MyConn.Execute(sqlstmt) MyConn.Close set MyConn=nothing end sub %> <% sub Contar() session("pontos")=session("pontos")+session("ganhapontos") Set MyConn=Server.CreateObject("ADODB.Connection") MyConn.Open "DSN=esabnet" sqlstmt="update alunos set pontos="&session("pontos") &" where nome='"&session("nome")&"'" Set MyRs=MyConn.Execute(sqlstmt) MyConn.Close set MyConn=nothing end sub %> --- You are currently subscribed to activeserverpages as: [EMAIL PROTECTED] To unsubscribe send a blank email to %%email.unsub%% --- You are currently subscribed to activeserverpages as: [email protected] To unsubscribe send a blank email to [EMAIL PROTECTED]
