473,761 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(Variabe l,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(oEventsL ist.GetBody()) > 20)
{
dot = "..."
}

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

Christopher Brandsdal
Norway

Jul 19 '05 #1
3 2245

"Christophe r Brandsdal" <ch***********@ c2i.net> wrote in message
news:%2******** ********@TK2MSF TNGP11.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=JScrip t %>
<%
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(Variabe l,20)%> How do I do this in Jscript?


<%
var x = "ABCDEFGHIJKLMN OPQRSTUVWXYZ"
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

"Christophe r Brandsdal" <ch***********@ c2i.net> wrote in message
news:%2******** ********@TK2MSF TNGP11.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(Variabe l,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(oEventsL ist.GetBody()) > 20)
{
dot = "..."
}

Response.Write (Left(oEventsLi st.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******** ******@TK2MSFTN GP11.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

"Christophe r Brandsdal" <ch***********@ c2i.net> wrote in message
news:%2******** ********@TK2MSF TNGP11.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(Variabe l,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(oEventsL ist.GetBody()) > 20)
{
dot = "..."
}

Response.Write (Left(oEventsLi st.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
6026
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
5973
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 javascript code and work out what it does but I can't really write it from scratch.
15
5464
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
9359
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 times it returns VarType() is vbEmpty. This is driving me mad! Also, does anyone know what the properties and methods are for the object returned by GetRef()? TIA.
5
5194
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 -- is there any similar code for an ASP page using VBscript? I want my Logout button to take them back to their homepage. I've looked into Response.Redirect, but I can't seem to find a way to take the user out of my program to their home default. ...
7
1556
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 like below: '------------------- For x = 1 To 10 Set oItemPrice = objXMLDoc.selectSingleNode("//Item/Price")
7
5798
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 Pool. One site gives the 800a0006 error on a formatpercent, another site (on the same server) does not. Here's the kicker...the one site only fails if the number is LESS THAN 1.
2
4566
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 is popped up by another ASP page and there are authentication, privilege and security stuff involved. And yes this page contain a lot of javascript. there is a <DIV></DIV> in this page for me. And my job is as simple as put another page between...
1
3476
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
9554
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10136
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9989
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9925
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8814
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7358
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3913
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.