The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> how to call javascript function from vbscript, please help!
TrojanNemo
post 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 blush.gif

thanks a ton...i'm looking forward to no more spam mail once i get this worked out smile.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
TrojanNemo
post 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...
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 24th April 2024 - 06:31 PM