![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| | #2 (permalink) |
| | 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 jscript. /Al Quote: > > --------------------------AND ---------- > > an4="" > > for i=wordcount to 0 > > an4=an4+john_array(i) + " " > > answer4.innerHTML=an4 > > > Thanks. |
My System Specs![]() |
| | #3 (permalink) |
| | 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 Specs![]() |
| | #4 (permalink) |
| | 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) if ... then [else] end if Quote: > > wordcount++; > wordcount = wordcount + 1 Quote: > for (x=0; x<len_john; x++) > 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 Specs![]() |
![]() |
| 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 | |||