471,082 Members | 908 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,082 software developers and data experts.

VBscript and JScript

Hi!

Maby this is wring newsgroup..

I'm using ASP / VBscript on my own cms system, but I needed to use some
jscript to make something work... I'm new to jscript, so here is a simple
question:

(1) I want to count how many characters there is in a string. In ASP I just
use <%=Len(Variabel)%> How do I do this in Jscript?

(2) How can I display only a numer of characters from a variabel or a
string? In ASP I use <%=Left(Variabel,20)%> How do I do this in Jscript?
THe code i use is part vbscript and jscript. Hope somone can help me
translate it to pure JScript :)
var dot

if(Len(oEventsList.GetBody()) > 20)
{
dot = "..."
}

Response.Write (Left(oEventsList.GetBody(),20) + dot + "<br><br>");
Thanks in advance!

Christopher Brandsdal
Norway

Jul 19 '05 #1
3 2121

"Christopher Brandsdal" <ch***********@c2i.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi!

Maby this is wring newsgroup..

I'm using ASP / VBscript on my own cms system, but I needed to use some
jscript to make something work... I'm new to jscript, so here is a simple
question:

(1) I want to count how many characters there is in a string. In ASP I just use <%=Len(Variabel)%> How do I do this in Jscript?
In jscript, strings are objects. You'd use the length property of the
object as so:

<%@ Language=JScript %>
<%
var x = "hi there."
Response.write(x.length)
%>


(2) How can I display only a numer of characters from a variabel or a
string? In ASP I use <%=Left(Variabel,20)%> How do I do this in Jscript?


<%
var x = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Response.write(x.substr(1,20))
%>
You can download the WSH documentation (which includes the jscript
documentation) here.
http://www.microsoft.com/downloads/d...6-1C4099D7BBB9

Or view the string object info here.
http://msdn.microsoft.com/library/en...sobjstring.asp

I think Microsoft did a great job on their scripting documentation.

Ray at work
Jul 19 '05 #2
You already had your answer from another group and were on your way with it
when I took time out of my day to answer your questions for you. This is
bothersome. Please do not multipost.

Ray at work

"Christopher Brandsdal" <ch***********@c2i.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi!

Maby this is wring newsgroup..

I'm using ASP / VBscript on my own cms system, but I needed to use some
jscript to make something work... I'm new to jscript, so here is a simple
question:

(1) I want to count how many characters there is in a string. In ASP I just use <%=Len(Variabel)%> How do I do this in Jscript?

(2) How can I display only a numer of characters from a variabel or a
string? In ASP I use <%=Left(Variabel,20)%> How do I do this in Jscript?
THe code i use is part vbscript and jscript. Hope somone can help me
translate it to pure JScript :)
var dot

if(Len(oEventsList.GetBody()) > 20)
{
dot = "..."
}

Response.Write (Left(oEventsList.GetBody(),20) + dot + "<br><br>");
Thanks in advance!

Christopher Brandsdal
Norway

Jul 19 '05 #3
Sorry I will NEVER multipost again.
But thank you for wanting helping me!

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> skrev i melding
news:OG**************@TK2MSFTNGP11.phx.gbl...
You already had your answer from another group and were on your way with it when I took time out of my day to answer your questions for you. This is
bothersome. Please do not multipost.

Ray at work

"Christopher Brandsdal" <ch***********@c2i.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi!

Maby this is wring newsgroup..

I'm using ASP / VBscript on my own cms system, but I needed to use some
jscript to make something work... I'm new to jscript, so here is a simple question:

(1) I want to count how many characters there is in a string. In ASP I

just
use <%=Len(Variabel)%> How do I do this in Jscript?

(2) How can I display only a numer of characters from a variabel or a
string? In ASP I use <%=Left(Variabel,20)%> How do I do this in Jscript?
THe code i use is part vbscript and jscript. Hope somone can help me
translate it to pure JScript :)
var dot

if(Len(oEventsList.GetBody()) > 20)
{
dot = "..."
}

Response.Write (Left(oEventsList.GetBody(),20) + dot + "<br><br>");
Thanks in advance!

Christopher Brandsdal
Norway


Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

29 posts views Thread by Christopher Brandsdal | last post: by
20 posts views Thread by Harag | last post: by
15 posts views Thread by Laser Lu | last post: by
16 posts views Thread by Mike Schinkel | last post: by
5 posts views Thread by gpence | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.