Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can HTML code be "Looped" with VBScript

Status
Not open for further replies.

jeremyhache

Programmer
Sep 30, 2002
19
0
0
US
I need to prepare a formatted page which is based on data sent from a previous page. I have a few variables which I use to calculate the number of pages which need to be created. I already formatted several tables to fit perfectly on 1 printed page. I need to be able to loop this behavior when the page loads so that it will create multiple pages, each formatted to it's own page when printed. Is there a way to loop my already formatted HTML in VBScript? EIther that, or is there a way to translate the HTML into VBScript??? I tried many ways to try and print out a table using VBScript, and I don't think it is possible. Please HELP!!! Thank you!
 
yes you can. there's a couple of ways to loop through data.
for x = 0 to 5
x=x+1
response.write "hi there!"
next
is one way
there's also:
do until x=5
x=x+1
response.write "hi there!"
loop

using the response.write, you can "print out" your html inside of the vbscript so...
response.write &quot;<table><tr><td>&quot;
response.write variable1value
response.write &quot;</td></tr></table>&quot;

obviously, I've kept this pretty basic but hopefully you can see how it applies to your situation and adapt your code appropriately.

hth
mb
:) &quot;Where's the Ka-Boom? There's supposed to be an Earth-shattering Ka-Boom!&quot;
Marvin the Martian
 
I think instead of response you need document.write
unless this is a ASP question ---------------------------------------
{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }
---------------------------------------
for the best results to your questions: FAQ333-2924

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top