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 - Show each word of array in a diff line

Reply
 
Old 03-21-2009   #1 (permalink)
antgaudi


 
 

Show each word of array in a diff line

I'm trying to show each word in an array on each line in vbscript.

I've tried:
dim ray(2)
ray(0)="ray1"
ray(1)="ray2"
ray(2)="ray3"

for i=0 to 2
document.write("
" & ray(i))
next

The code above works but I now need to get words in an array and show each
word on a different line in a span block named answer3.

The answer I currently get is only "tools" from the "john" string..
The code I have is:

<html>
<head>
<script language="vbscript">
<!--
sub fred
john_val=window.document.alice.john.value

dim joarsp
joarsp=split(john_val, " ")
answer2.innerHTML=joarsp(0)+cstr(" ")+joarsp(12)

for i=0 to 12
answer3.innerHTML=(joarsp(i) & "
")
next

end sub
-->
</script>
</head>
<body>
<form name="alice">

The string john = <input type="text" size="60" name="john" value="this is a
string for the purpose of playing with string coding tools">
</form>

<ol>
<li><span id="answer2">this is the contents of the span block with id
answer2</span>
<li><span id="answer3">this is the contents of the span block with id
answer3</span>
</ol>


<input type="button" value="GO" onClick="fred">
</body>
</html>

Thanks.

My System SpecsSystem Spec
Old 03-21-2009   #2 (permalink)
Hz


 
 

Re: Show each word of array in a diff line

For i = 0 to 2
response.write(ray(i)) & "<br>" & vbCrLf
Next

--
..::[ Hz ]::.
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
the word [SPAM] added to subject line Live Mail
array members to outfile on new line PowerShell
Read word doc line-by-line VB Script
How to debug a vbscript/ show each line BEFORE execution and with var values? VB Script
Line distance Word 2000 Vista General


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