473,230 Members | 1,549 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,230 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 2218

"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: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.