Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Call a javascript with vb variables

Posted on 2003-02-19
Medium Priority
Last Modified: 2010-04-06
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);">
Question by:maltais

Accepted Solution

Kovis earned 100 total points
ID: 7983127
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() {

LVL 30

Expert Comment

ID: 7984506
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...

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question