?
Solved

Call a javascript with vb variables

Posted on 2003-02-19
2
Medium Priority
?
177 Views
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)
  }
  document.form_action.submit();
}
</script>

<FORM method="POST"
onSubmit="javascript:clearFiles(myFolder, myResultFile);">
0
Comment
Question by:maltais
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
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() {
  alert(strVBVariable);
 }

</script>
0
 
LVL 30

Expert Comment

by:third
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...
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

752 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