Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > VBscript and JScript

Reply
Thread Tools

VBscript and JScript

 
 
Christopher Brandsdal
Guest
Posts: n/a
 
      01-22-2004
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



 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      01-22-2004

"Christopher Brandsdal" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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


 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      01-22-2004
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>
>
>



 
Reply With Quote
 
Christopher Brandsdal
Guest
Posts: n/a
 
      01-22-2004
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:OGAQ$(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > 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
> >
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
window - jscript and vbscript Eugene Anthony ASP General 3 06-21-2006 03:51 PM
What is Server-Side Jscript (not Jscript.NET)? Maxwell2006 ASP .Net 5 03-07-2006 05:28 AM
Porting from JScript to JScript.Net - compiler error Jon Maz ASP .Net 4 09-09-2004 10:24 AM
VBScript and JScript Serge Myrand ASP General 3 07-14-2004 07:14 PM
JScript and VBscript Christopher Brandsdal ASP General 24 12-31-2003 08:11 PM



Advertisments