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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

use Javascript in VBScript(ASP) routine 1

Status
Not open for further replies.

PaulBricker

Programmer
Sep 25, 2002
3,554
US
What I currently have is a page (sorry it's an intranet site so I can't display it)that has a scroller I got at Dynamic Drive. I have to go in manually and change the content of that scroller each week. I would like to be able to pull the content for the scroller from a database table instead so that the Admin Assistant can make the changes in the table and keep me out of the loop. So to that end, I have this on my page.
Code:
[green]<%ON ERROR RESUME NEXT
IF rst.EOF THEN
	Response.Write "There are no entries in the database."
ELSE        
        Response.Write "var pausecontent2=new Array();"%>[/green]
	<p>
	 [green]<%  i = 0
	DO WHILE NOT rst.EOF 
	 Response.Write "pausecontent2[" & i & "]='" & rst("Dept ID") & "';"[/green]

	<p>
	[green]<%
        i=i+1
		rst.MoveNext
		
	Loop 
	

END IF %>[/green]

The result should produce script that looks like this

Code:
<script type="text/javascript">

var pausecontent2=new Array()
pausecontent2[0]='Dining Hall Windows'
pausecontent2[1]='WB Bathroom conversion'
pausecontent2[2]='Chapel/Parking Lot Light'
pausecontent2[3]='Ath Ctr Rooftop Unit Repair'
pausecontent2[4]='Ath Ctr Wrestling Room Roof'
 
</script>

that get passed to this function

Code:
<script type="text/javascript">

new pausescroller(pausecontent2, "pscroller2", "someclass", 3000)

</script>
The first code does produce a string result that gives me the appearance I need in the array, but, of course, Response.Write just writes it to the page. I need to create a <script type = "text/javascript"></script> array on the page that the function can read.
Clear as mud?
Anyone have any ideas?
I thought I had found a winner here
but I can't get it to work.

Thanks

Paul
 
Cool, glad it worked.

-kaht

Looking for a puppy? [small](Silky Terriers are hypoallergenic dogs that make great indoor pets due to their lack of shedding and small size)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top