problem with mid() function

J

Joeandtel

'When I create a single character string
var str = "A"
'convert to ascii
num = asc(str)
Response.Write num ' 65 shows up
'when I have a whole string
str = "hello"
str = mid(str, 1, 1) ' return 'h'
num = asc(str)
'I get an error:
Invalid procedure call or argument: 'asc'
What can be done to fix this?
 
R

Ray at

What language are you using here? It looks like it's half jscript, half
vbscript.

Ray at work
 
E

Evertjan.

Joeandtel wrote on 14 nov 2003 in
microsoft.public.inetserver.asp.general:
'When I create a single character string
var str = "A"
'convert to ascii
num = asc(str)
Response.Write num ' 65 shows up
'when I have a whole string
str = "hello"
str = mid(str, 1, 1) ' return 'h'
num = asc(str)
'I get an error:
Invalid procedure call or argument: 'asc'
What can be done to fix this?

<%

response.write asc("h") &"<br>"
response.write asc("hello") &"<br>"

str="hello"
response.write asc(str) &"<br>"
s=mid(str,1,1)
response.write asc(str) &"<br>"

response.write asc(mid("hello",1,1)) &"<br>"

%>

gives:

104
104
104
104
104

no error to be seen.
 
E

Evertjan.

Evertjan. wrote on 14 nov 2003 in
microsoft.public.inetserver.asp.general:
Joeandtel wrote on 14 nov 2003 in
microsoft.public.inetserver.asp.general:

var is j(ava)script, not vbscript

num is undefined
<%

response.write asc("h") &"<br>"
response.write asc("hello") &"<br>"

str="hello"
response.write asc(str) &"<br>"
s=mid(str,1,1)

str=mid(str,1,1) ' I mean
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,900
Latest member
Nell636132

Latest Threads

Top