Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Change a Javascript code to VBScript

Reply
 
Old 04-23-2009   #1 (permalink)
antgaudi


 
 

Change a Javascript code to VBScript

I have the following codes and I'm trying to write in VBScript:


wordcount=0;

if (len_john>0)

wordcount++;

for (x=0; x<len_john; x++)

{

if ((john_val.charAt(x)==" "))

{

wordcount++;

}

}

answer1.innerHTML=wordcount;

------------------------------------

four_string="";

for (x=wordcount-1; x>=0; x--)

{

four_string=four_string+john_array[x]+" ";

}

answer4.innerHTML=four_string;

------------------------------------I'VE TRIED WITHOUT SUCCESS:

wordcount=0;

if len_john>0

wordcount++

for i=0 to len_john

if (john_val.mid(i)==" ")

wordcount++



answer1.innerHTML=wordcount

--------------------------AND ----------

an4=""

for i=wordcount to 0

an4=an4+john_array(i) + " "

answer4.innerHTML=an4


Thanks.

My System SpecsSystem Spec
Old 04-23-2009   #2 (permalink)
Al Dunbar


 
 

Re: Change a Javascript code to VBScript


"antgaudi" <antgaudi@xxxxxx> wrote in message
news:EA8A1243-AE5B-451A-9572-5C93102667AB@xxxxxx
Quote:

>I have the following codes and I'm trying to write in VBScript:
>
>
> wordcount=0;
>
> if (len_john>0)
>
> wordcount++;
>
> for (x=0; x<len_john; x++)
>
> {
>
> if ((john_val.charAt(x)==" "))
>
> {
>
> wordcount++;
>
> }
>
> }
>
> answer1.innerHTML=wordcount;
>
> ------------------------------------
>
> four_string="";
>
> for (x=wordcount-1; x>=0; x--)
>
> {
>
> four_string=four_string+john_array[x]+" ";
>
> }
>
> answer4.innerHTML=four_string;
>
> ------------------------------------I'VE TRIED WITHOUT SUCCESS:
>
> wordcount=0;
>
> if len_john>0
>
> wordcount++
>
> for i=0 to len_john
>
> if (john_val.mid(i)==" ")
>
> wordcount++
>
>
>
> answer1.innerHTML=wordcount
You'll have to try to stick to vbscript syntax; the above looks more like
jscript.

/Al
Quote:

>
> --------------------------AND ----------
>
> an4=""
>
> for i=wordcount to 0
>
> an4=an4+john_array(i) + " "
>
> answer4.innerHTML=an4
>
>
> Thanks.

My System SpecsSystem Spec
Old 04-23-2009   #3 (permalink)
antgaudi


 
 

Re: Change a Javascript code to VBScript

I have to stick to both actually but I have only the code for JavaScript.
I just need a little help with writing the same code but with VBScript.

Thanks.

"Al Dunbar" wrote:
Quote:

>
> "antgaudi" <antgaudi@xxxxxx> wrote in message
> news:EA8A1243-AE5B-451A-9572-5C93102667AB@xxxxxx
Quote:

> >I have the following codes and I'm trying to write in VBScript:
> >
> >
> > wordcount=0;
> >
> > if (len_john>0)
> >
> > wordcount++;
> >
> > for (x=0; x<len_john; x++)
> >
> > {
> >
> > if ((john_val.charAt(x)==" "))
> >
> > {
> >
> > wordcount++;
> >
> > }
> >
> > }
> >
> > answer1.innerHTML=wordcount;
> >
> > ------------------------------------
> >
> > four_string="";
> >
> > for (x=wordcount-1; x>=0; x--)
> >
> > {
> >
> > four_string=four_string+john_array[x]+" ";
> >
> > }
> >
> > answer4.innerHTML=four_string;
> >
> > ------------------------------------I'VE TRIED WITHOUT SUCCESS:
> >
> > wordcount=0;
> >
> > if len_john>0
> >
> > wordcount++
> >
> > for i=0 to len_john
> >
> > if (john_val.mid(i)==" ")
> >
> > wordcount++
> >
> >
> >
> > answer1.innerHTML=wordcount
>
> You'll have to try to stick to vbscript syntax; the above looks more like
> jscript.
>
> /Al
>
Quote:

> >
> > --------------------------AND ----------
> >
> > an4=""
> >
> > for i=wordcount to 0
> >
> > an4=an4+john_array(i) + " "
> >
> > answer4.innerHTML=an4
> >
> >
> > Thanks.
>
>
>
My System SpecsSystem Spec
Old 04-24-2009   #4 (permalink)
Bob Barrows


 
 

Re: Change a Javascript code to VBScript

I'm not going to rewrite the whole thing, just provide a couple of hints.
For starters, here is the documentation:
http://tinyurl.com/7rk6

See inline:

antgaudi wrote:
Quote:

> I have the following codes and I'm trying to write in VBScript:
>
>
> wordcount=0;
>
> if (len_john>0)
vbscript:
if ... then
[else]
end if
Quote:

>
> wordcount++;
>
vbscript:
wordcount = wordcount + 1
Quote:

> for (x=0; x<len_john; x++)
>
vbscript:
for x=0 to len_john-1
next

--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Convert Vb code to VBscript VB Script
How to change img scr in vbscript VB Script
Start VBscript code VB Script
RE: What to code in now that VS2008 has depreciated VBScript? VB Script
how can I change the mail code Live Mail


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46