calling a javascript function in from VBscript

This is a discussion on "calling a javascript function in from VBscript" within the Classic ASP section. This forum, and the thread "calling a javascript function in from VBscript are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Sep 18th, 2003, 19:44
Reputable Member
Join Date: Sep 2003
Location: USA
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
calling a javascript function in from VBscript

So I've got this validation code that does a complex enough function that I don't want to convert it to VBscript.

But now I need to do validation on an ASP page.

so I've got this fucntion in javascript:
IsISBN(isbn) {
some validation stuff with a boolean return
}

and from my page I want to do something like
Code: Select all
<%
  myArray(3,1)
  for i = 0 to 3
    fieldname = "isbn" & i
    myArray(i, 0) = request.form(myField)
    myArray(i,1) = IsISBN (myArray(i,0))
  next 
  ...
%>
is this even remotely possible or am I stuck converting my validation function?

Thanks
jakyra

  #2 (permalink)  
Old Sep 19th, 2003, 09:45
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,953
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
I would just convert it.... why wouldn't you?

Anyway, after looking at how ISBN Validation works, I did this:-
Code: Select all
Function CheckISBN(x)
	Length = Len(x)
	If NOT (Length > 10 Or Length = 0) Then 
		intValue = 0
		For Counter = 10 To 1 Step -1
			If Counter <= Length Then
        		intValue = intValue + (Counter * Mid(x, ((-1 * Counter) + Length + 1), 1))
	    	End If
		Next
		CheckISBN = (intValue Mod 11 = 0)

	Else
    		CheckISBN = False
	End If
End Function
I admit, I have not accounted for the X's that are allowed in ISBN numbers, and the function will fall-over if it comes across an X in an ISBN.... but hey, I didn't want to strip the entire challenge away from you!!

I've started you off, so just fill in the last bits!!

Rob
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #3 (permalink)  
Old Sep 22nd, 2003, 23:13
Reputable Member
Join Date: Sep 2003
Location: USA
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
'cause I'm lazy.

I was just wondering if there was an easy way to save myself some time.

Ahh well, on to the conversion board.

Thanks!
jakyra
Closed Thread

Tags
calling, javascript, function, vbscript

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
calling functions in a function fatsurfer PHP Forum 1 Jun 12th, 2008 21:53
calling php function on click of a hyperlink csun PHP Forum 2 Jul 15th, 2007 16:27
problem calling function via onClick Eagle JavaScript Forum 5 Jan 15th, 2007 21:41
plz help me verify this... calling function melvinoyh JavaScript Forum 0 May 29th, 2006 01:35
Difficulty calling a javascript function? grittyminder JavaScript Forum 4 Jul 21st, 2005 17:48


All times are GMT. The time now is 07:36.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43