Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 5th, 2004, 01:05 PM
Registered User
 
Join Date: Apr 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using VBScript and JSScript together?

Hi - I hope you can help. I am trying to create a slideshow on one of my asp pages. I have downloaded code from:
http://www.barelyfitz.com/webapps/apps/slideshow/
to create the slide show and it works great.

Here is the javascript used in the section I am having the problem:

<SCRIPT type="text/javascript">
<!--
SLIDES = new slideshow("SLIDES");

s = new slide();
s.src = "images/Barry/Barry1.jpg";
s.text = "";
SLIDES.add_slide(s);

s = new slide();
s.src = "images/Barry/Barry2.jpg";
s.text = "";
SLIDES.add_slide(s);

s = new slide();
s.src = "images/Barry/Barry3.jpg";
s.text = "";
SLIDES.add_slide(s);
//-->
</SCRIPT>

For each image I want added to the slideshow I must repeat this code:
s = new slide();
s.src = "images/Barry/Barry1.jpg";
s.text = "";
SLIDES.add_slide(s);

I have a recordset containing the image names. Is there any way to incorporate a do until rs.eof -- loop around the javascript code?

Thanks for your help!

  #2 (permalink)  
Old April 6th, 2004, 04:04 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

can't you re-write your asp code in JS?

If not you'll have to provide JS wrapper function to call the SLIDES object because VBS can't use JS objects.
  #3 (permalink)  
Old June 7th, 2004, 01:25 PM
Registered User
 
Join Date: Jun 2004
Location: Charlotte, NC, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have done this before, but have never heard someone suggest doing it. Maybe there's a good reason that I haven't heard it suggested before, but here goes:

You can incorporate both together by using VBScript to write out the JS, just like you can use it to generate HTML. Example:

<%
Response.Write "<script language='JavaScript'>" & chr(10) & chr(13)
Response.Write "function sampleJS () {" & chr(10) & chr(13)

Dim rs
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "TableName", sConnect, adOpenStatic, adLockOptimistic, adCmdTable
While Not rs.eof
Response.Write "document.write 'here is the first field: '" & rs("SampleField") & chr(10) & chr(13)
rs.MoveNext
Wend
Response.Write "}" & chr(10) & chr(13)
Response.Write "</script>"

I hope that helps.



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBScript junedali10 VB How-To 3 September 27th, 2006 03:06 PM
VBSCRIPT pantera710 Classic ASP Basics 3 September 11th, 2006 09:28 PM
Need Help in VBScript ragavendran31 Pro VB 6 0 April 19th, 2006 05:54 AM
Using JScript with VBScript jwalborn Javascript How-To 4 October 13th, 2003 10:07 AM
Using VBScript and JavaScript together jwalborn Classic ASP Professional 2 October 13th, 2003 10:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.