BYS2
07-06-2006, 07:29 PM
i am currently making a website with asp and i am having a little problem. i am using VBscript for the asp page but at some point in the code i want to call a javascript function (i am better with javascript). so here is some sample code:
<html>
<head>
<title>hi</title>
</head>
<body>
<script language='javascript' runat='server'>
function getFirstLetter(text)
{
var display = text.substring(0,1)
response.write(display)
}
</script>
<%
Dim test
test = "this is a test"
call getFirstLetter(test)
%>
</body>
</html>
the function is just suppoesd to get the first letter of the word and print it out but for some reason it does not work.. but when i replace the javascript function with a vbscript version:
sub getFirstLetter (text)
var display = left(text,1)
response.write(display)
end sub
then it works fine..
i don't know why my javascript function won't run... does server-side javascript not have these basic string methods?
<html>
<head>
<title>hi</title>
</head>
<body>
<script language='javascript' runat='server'>
function getFirstLetter(text)
{
var display = text.substring(0,1)
response.write(display)
}
</script>
<%
Dim test
test = "this is a test"
call getFirstLetter(test)
%>
</body>
</html>
the function is just suppoesd to get the first letter of the word and print it out but for some reason it does not work.. but when i replace the javascript function with a vbscript version:
sub getFirstLetter (text)
var display = left(text,1)
response.write(display)
end sub
then it works fine..
i don't know why my javascript function won't run... does server-side javascript not have these basic string methods?