473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 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 2223

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
by: Christopher Brandsdal | last post by:
If I have a .ASP page that runs JScript code - is it possible to include an ..ASP page that runs VBscript???
20
by: Harag | last post by:
Hi All. I'm stating out doing some web developing. I was wondering which of the server side languages should I concentrate on and learn. I Know CSS, HTML, T-SQL I can look at the client...
15
by: Laser Lu | last post by:
In ASP and CGI, which one would be executed more fast and has the better execution efficiency in IIS? And how about writing CGI in VB? -- Best regards, Laser Lu
16
by: Mike Schinkel | last post by:
Does anyone know if there are bugs in VBScript's GetRef()? I'm using VBScript Version 5.6.8515 on Win2003Server w/ASP. Sometimes it returns an object that VarType() says is a vbObject. Other...
5
by: gpence | last post by:
!!! Newbie question warning !!! I am somewhat familiar with javascript's ability to "access" the browser's favorites list -- for example, using window.home() will take you to the default URL --...
7
by: joe | last post by:
I am having problems checking for the value of an XMLDOM object . Lets say my XMLDOM object was successfully created as objXMLDoc, and that has several nodes on it. In the case of a VBScript loop...
7
by: dkiernan | last post by:
I am stumped. I have several websites running on a 2003 IIS6 box, all running basically the same code (each site has its own home directory and copy of the code). All are running in the same App...
2
by: tunk | last post by:
I dont know where to start my question so let me tell you my story :) The ASP that cause me trouble is running on IIS that set ASP default language to JScript instead of VBScript. This ASP page...
1
by: Andrew Wan | last post by:
How can VBScript code access JScript code variables in the same ASP page? <SCRIPT LANGAUGE="VBScript"> Dim a a = 10 </SCRIPT> <SCRIPT LANGUAGE="JScript"> Response.Write(a); </SCRIPT>
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.