Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To 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
Old November 5th, 2003, 08:44 PM
Registered User
Join Date: Nov 2003
Location: Toluca Lake, California, USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default asp within javascript?

I am working on a page where the javascript needs to be dynamically written depending on the content for the page. The content for the page is determined with VBScript.

I have tried to write the javascript with <% asp vbs code%> inserting the vbscript variables, but that is not working.

Is there a way to write the javascript server side using asp so it will work client side?

Old November 14th, 2003, 12:39 PM
Authorized User
Join Date: Jul 2003
Location: Dublin, Ireland, Ireland.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts

you could create the page dynamically using a dll. it can be done in vb/vfp/delphi etc.

Mark Hardiman
Senior Developer
Kernel Software Ltd
Old November 14th, 2003, 04:17 PM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

You don't specify what not working means. One thing to watch out for is to split script tags or you'll confuse the parser:
  Dim sName
  sName = GetNameFromDatabase() 
  Dim sScript
  sScript = "<scr" & "ipt type=""text/javascript""" & vbCrLf
  sScript = sScript & "alert(""" & sName & "");" & vbCrLf
  sScript = sScript & "</scr" & "ipt>" & vbCrLf
  Response.Write sScript



Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining Javascript and ASP chuksted C# 5 June 16th, 2005 10:25 AM
asp/javascript Toka1 Classic ASP Basics 4 April 26th, 2004 06:13 AM
using asp to write javascript vivalet Classic ASP Basics 3 November 6th, 2003 02:02 PM
asp and javascript. face Classic ASP Databases 1 September 22nd, 2003 11:33 AM

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