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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you call a VB funciton using JS?

Status
Not open for further replies.

zzfive03

Programmer
Jun 11, 2001
267
I have a text box that when onblur is set, I want it to call my VB function. I don't know how to propery call my function from the onblur call. Here is my code example:

**********
'My text box code
Response.Write(&quot;<textarea rows=10 cols = 70 onblur='save_comment()'> </textarea>&quot;)

'My VB funciton (on the same page)
Sub save_comment
Response.Write(&quot;test&quot;)
End Sub
**********

I keep getting an error where the onblur does not understand I have a function on the page? What am I doing wrong?
Thanks in advance for your help.
 
If that vbscript is client-side, try doing this:

onBlur=&quot;vbscript:save_comment()&quot;

The default scripting language is usually going to be javascript, which is why it might be throwing an &quot;Object Expected&quot; error.

If it's server side, then you're going to have to reload the page to get the function to work. Because the server side functions are not available to you once your page is finished loading. There is an exception to that rule with Remote Scripting, but that's a whole other can of worms.

hope that helps! :)
Paul Prewett
penny.gif
penny.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top