Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling a vbscript function within a javascript even onUnload

Status
Not open for further replies.

biktoryah

Programmer
Mar 14, 2003
9
0
0
PH
function hello()
{
var x;
x = &quot;<%call unsetFlagUpdate(strAccntNum)%>&quot;;

return true;

}

<body onUnload=&quot;hello();&quot;>

i have tried using this code but unfortunately when the page loads it already calls the unsetFlagUpdate vbscript function even though the hello() javascript function has not been called yet..is there another way that you could suggest where in i call a vbscript function on the onunload event of javascript?

thanks a bunch,
biktoryah
 
biktoryah:

Server side code is always executed before client-side. The only way to call a server-side function from client side is to use either Remote-Scripting. Here is a great article on that technology:


Another way is to re-write the function client-side and execute it. Maybe you can show me the unsetFlagUpdate function and I can maybe suggest something better.

[yinyang]
Patrick
 
Function unsetFlagUpdate(strAccnt)

aConnectionString = &quot;File Name=&quot; & onRequestConnection()

set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.Mode = adModeReadWrite
conn.ConnectionString = aConnectionString
conn.open

strSQL = &quot;Update TBLCACS &quot; _
& &quot;set FlagUpdate = 0 &quot; _
& &quot;where CARDNUMBER = '&quot; & strAccnt & &quot;'&quot;

conn.execute strSQL,,adCmdText

end Function


here's the unsetFlagUpdate function...tnx in advance..

biktoryah
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top