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

I can call a VBScript function inside JavaScript function?????

Status
Not open for further replies.

JMQ

ISP
Nov 23, 2003
1
GB
I can call a VBScript function inside JavaScript function????
 
Yes u can.

<HTML>
<script language=&quot;vbscript&quot;>
function MyFunction
MyFunction=&quot;My VBScript Function Value&quot;
end function
</script>

<script language=&quot;javascript&quot;>
var MyValue=MyFunction();
alert(MyValue);
</script>
</HTML>
 
I have this same need, but your solution is unclear to me. What I have is some JavaScript which performs validation, but I need to call a spell checker sub in VBScript before submitting. Can you clarify the syntax for calling a VBScript sub from within JavaScript? Thanks!!
 
<HTML>
<form ...blah...>

<input type=&quot;button&quot; value=&quot;Submit&quot; onclick=&quot;doValidation()&quot;>
</form>


<script language=&quot;vbscript&quot;>
function SpellCheck(textToSpellCheck)
'do the spell check to variable textToSpellCheck
SpellCheck=true
'if spell check is not ok
'SpellCheck=false
end function
</script>

<script language=&quot;javascript&quot;>
function doValidation()
{
if(SpellCheck(document.form.MyTextBox.value)) document.form.submit();
else
document.form.MyTextBox.focus();
};
</script>
</HTML>

doValidation is a java fuction that call the SpellCheck function with an text box from the form that will be submitted and see if the spellcheck is correct if is correct
return true and javascript do the submit, if not return false and not submit...





________

George
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top