Call a javascript with vb variables

How could I call a javascript function using some vb variable

here is a sample of my code...

<script language=javascript>
function clearFiles(jsFolder,jsTempResultFiles)
  var jsFSO;
  jsFSO = new ActiveXObject("Scripting.FileSystemObject");
  if (jsFSO.FolderExists(jsFolder))
     jsFSO.DeleteFile(jsFolder + jsTempResultFiles)

<FORM method="POST"
onSubmit="javascript:clearFiles(myFolder, myResultFile);">
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I assume you want to write server VB variable to client and use it in a javascript function? That's easy, just add javascript variable and set it's value.

<script language="javascript">
 var strVBVariable = "<%=myVariable%>";

 function Test() {


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
if these are both client-side, you have to use form elements as your interpreter. for example, you have a vb variable and you want it to pass to javascript then what you need to do is fill a hidden form field with that value and let javascript grab the value from that very same hidden form field or vice versa. hope this helps...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.