Wrox Programmer Forums
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. 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 Databases 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 April 5th, 2005, 07:33 PM
Friend of Wrox
Join Date: Jul 2004
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default putting asp and javascript together

I have a database table where I managed to add with ASP an extra column which breaks down the previous column "text_data" and counts the number of words:

<%  Dim TheString, ArrayTemp, NumberOfWords, Word
    TheString = rs("text_data")
    ArrayTemp = split(TheString, " ")
    NumberOfWords = UBound(ArrayTemp) + 1
'    Response.Write "<P>The String is: " & TheString
    Response.Write "<P>Number of words: " & NumberOfWords
'    Response.Write "<P>Here are the words which compose that string: "
    For Each Word In ArrayTemp
    Response.Write "<BR>" & word & " = "

My goal is to take each letter and assign them to a number:
Which I have done in another place with JavaScript:
   //&&& 1st of 2 instances of getKeyValue(). changed name of Fx, '_h' for hebrew? 
   function getKeyValue_h(chr) { 
   //A switch statement is more efficient for this
     case "a": return 1; 
     case "b": return 2; 
     case "g": return 3; 
     case "d": return 4; 
     case "h": return 5; 
     case "w": return 6; 
     case "x": return 8; 
     case "j": return 9; 
     case "y": return 10; 
     case "k":;
     case "$": return 20; 
     case "l": return 30; 
     case "m":;
     case "~": return 40; 
     case "n":;
     case "!": return 50; 
     case "s": return 60; 
     case "[": return 70; 
     case "p":;
     case "@": return 80; 
     case "c":;
     case "#": return 90; 
     case "q": return 100; 
     case "r": return 200;
     case "f":; 
     case "v": return 300; 
     case "t": return 400;
     default: return 0; 

   function computeValue(str) { 
    var ans = 0; 
    for(var i = 0; i < str.length; i++) { 
     ans += getKeyValue_h(str.charAt(i));
    return ans; 
The JavaScript was for a textbox object and textarea. Is there a way to calculate (add) the numbers of the letters assigned after each " = " in the ASP code?

Martial Law 9/11 Rise of the Police State is now available! Visit our Martial Law movie section for complete info (click here), or order now by clicking the button below or by calling 888-253-3139

Similar Threads
Thread Thread Starter Forum Replies Last Post
Putting JavaScript Events on RadioButtonList Items MikeSchnell ASP.NET 1.0 and 1.1 Basics 6 October 7th, 2007 08:16 PM
putting values frm javascript f'n into session rajeshshinde Javascript How-To 1 December 18th, 2006 01:10 AM
Putting it all together lincsimp XSLT 1 August 22nd, 2005 08:49 AM
Putting VBScript in an ASP.NET page jturlington ASP.NET 1.0 and 1.1 Basics 1 May 14th, 2005 09:00 PM
putting it another way MetsFan BOOK: Professional Crystal Reports for VS.NET 1 June 4th, 2004 12:12 PM

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