sushant
sushant

Reputation: 943

passing variables to a function. getting error:cannot use parenthesis when calling a sub

x="D:\d"     
y="ehgfh"     
button onclick="zips (x,y)" id=button1 name=button1>clickme</button>     

function zips(x,y)     
alert(y)    
dim shell,z    
z="c.bat " & x    

set shell=createobject("wscript.shell")    

shell.Run z, 1, true    
shell.Run "a.bat", 1, true    
set shell=nothing     
end function    

How do I eliminate the error?

Upvotes: 2

Views: 5252

Answers (1)

Prutswonder
Prutswonder

Reputation: 10064

VScript doesn't support using parenthesis when calling functions. Instead of using:

button onclick="zips (x,y)"

You should use:

button onclick="zips x, y"

Or use the Call statement, which does support the use of parenthesis:

button onclick="Call zips(x,y)"

Upvotes: 1

Related Questions