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!

Call function from Form button onClick Action.

Status
Not open for further replies.

Zycmi

IS-IT--Management
Jun 19, 2002
42
CA
Hi, I'm having some trouble getting a function call within an onCLick action of a Form button working. The contents of the function must be defined as vbScript as per the example below.

Does anyone have any idea why it won't recognize my function?
Thanks in advance.
Zycmi

---------Code follows----------------

<%@LANGUAGE=&quot;VBSCRIPT&quot; CODEPAGE=&quot;1252&quot;%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body>
<form action=&quot;temp2.asp&quot; method=&quot;post&quot;>
<input name=&quot;submit&quot; type=&quot;submit&quot; onClick=&quot;<%fncDoThis()%>&quot; value=&quot;submit&quot;>
</form>

<script language=&quot;vbscript&quot;>
Private Function fncDoThis()
Msgbox (&quot;Hello&quot;)
end Function
</script>
</body>
</html>


---------Error Message Follows-------
Microsoft VBScript runtime error '800a000d'

Type mismatch: 'fncDoThis'

/sudbury/site/org/forms/media/temp/temp.asp, line 10
 
Reference 3 in this FAQ faq333-3048

_________________________________________________________
for the best results to your questions: FAQ333-2924
01001111 01101110 01110000 01101110 01110100
onpnt2.gif
[/sub]
 
I've also tried setting the vbscript to Run at server.
That also gave no results.
 
You should have read the faq better, what it means is thant client side javascript cannot call server side vbscript. If both are client or server, you can.
If you want to run a server side script, you need to reload the page to do so.
Remember that client-side VBScript is only supported by Internet Explorer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top