how to call javascript function from vbscript, please help! |
how to call javascript function from vbscript, please help! |
TrojanNemo |
Dec 27 2008, 03:54 AM
Post
#1
|
Group: Members Posts: 6 Joined: 27-May 08 From: Miami, Florida Member No.: 5,757 |
hey guys. i know very little html...and until 2 days ago NO ASP whatsoever, but i kept getting spam mail through my contact form on my site so i decided to implement a captcha...and oh my how complicated this is...
after two days i'm down to needing to call client-side javascript function from within a server-side vbscript...here's what i have: CODE <script runat="server"> Sub btnValidate_Click(ByVal sender As Object, ByVal e As EventArgs) If Page.IsValid Then lblval.Text="Validation succeeded. Thank you." lblVal.ForeColor = Drawing.Color.Green <- HERE IS WHERE I NEED TO CALL THE JAVASCRIPT FUNCTION -> Else lblval.Text= "Validation failed. Please try again." lblVal.ForeColor = Drawing.Color.Red End If End Sub </script> this code checks if the captcha response is correct (using ASP.NET validation i believe) and outputs strings. this works just fine. CODE <script language="JavaScript"> function ChangeButtons(){ vButton=document.getElementById('btnValidate'); document.MForm.dSubmit.disabled=false; vButton.style.display = "none"; document.MForm.aName.focus(); } </script> this code hides the Validate button, enables the submit button, and then puts the focus on the first field of the contact form...this also works fine. my problem is getting the vbscript to call the javascript forth where I specified above. i've tried different ways of attempting to call that javascript function from the vbscript but i keep getting "server application errors" from IE... i need to implement the code of that function precisely at the point where I inserted the CAPS text above...how can I do it?! when posting a response, please keep in mind my asp knowledge is very limited thanks a ton...i'm looking forward to no more spam mail once i get this worked out |
TrojanNemo |
Dec 28 2008, 12:24 AM
Post
#2
|
Group: Members Posts: 6 Joined: 27-May 08 From: Miami, Florida Member No.: 5,757 |
well didnt exactly figure it out...but i got it to work.
implemented a javascript timer to check for the content of the label after the vbscript function writes to it... and tweaked it until it worked in IE7, Firefox 3, Flock, Chrome, Opera and Safari...now to tackle IE8 beta and netscape... |
Lo-Fi Version | Time is now: 24th April 2024 - 06:31 PM |