Recreated Vbscript Functions For Use In JavaScript
Sep 23, 2005
Here is a compilation/creation/collection of recreated vbscript functions for use in JavaScript. Additions and criticism are of course welcome.
Zip file contains:
vbs.js
ReadMe.html
<Edit>Surprisingly there haven't been many downloads for this. Here's a quick overview of the contents:</Edit>
==================================================
==================================================
CreateObject(x)
Translates into: new ActiveXObject(x)
dateDiff(p_Interval, p_Date1, p_Date2,p_firstdayofweek, p_firstweekofyear)
Returns the number of intervals between two dates
datePart(p_Interval, p_Date,p_firstdayofweek, p_firstweekofyear)
Returns the specified part of a given date.
FormatCurrency(Expression, NumDigitsAfterDecimal,IncludeLeadingDigit,UseParensForNegativeNumbers, GroupDigits)
FormatDateTime(datetime, FormatType)
FormatNumber(Expression, NumDigitsAfterDecimal,IncludeLeadingDigit,UseParensForNegativeNumbers, GroupDigits)
FormatPercent(Expression, NumDigitsAfterDecimal,IncludeLeadingDigit,UseParensForNegativeNumbers, GroupDigits)
InStr(strSearch,charSearchFor)
Returns the first location a substring SearchForStr that was found in the string str
isDate(p_Expression)
Left(string, length)
Returns a specified number of characters from the left side of a string.
Len(str)
Returns the number of characters in a string.
LTrim(str)
Returns a copy of a string without leading spaces.
Mid(str,start,len)
Returns a specified number of characters from a string.
monthName(p_Date, p_abbreviate)
Now()
Returns the current date and time.
Right(string, length)
Returns a specified number of characters from the right side of a string
RTrim(string)
Returns a copy of a string without trailing spaces.
Trim(strInput)
Removes leading and trailing spaces
weekdayName(p_Date, p_abbreviate)
================================================
================================================
View 1 Replies
ADVERTISEMENT
Jul 23, 2005
The user clicks on the delete icon, and gets a JavaScript client-side popup
to confirm that he wants to delete. I am passing this client-side function
a contactID.
Then, I want to send the result of this confirm (true|false) to a
server-side VBScript function, along with the contactID.
The VBScript function will then perform a delete in the database for the
specified contactID.
I have seen many examples about sending stuff back and forth between
JavaScript and VBScript, between server and client, but all the examples I
see are just popping up generic alerts and such. I need to execute some JS
on the client side, return a value, and send it to a VBScript function on
the server side.
View 3 Replies
View Related
Aug 25, 2003
Is it possible to exchange data between Javascript and VBScript! In other words can they communicate!
View 4 Replies
View Related
Oct 17, 2005
I have some pages with this VBScript code, which obviously does not
work in Firefox. How can I convert this to Javascript in order for my
web page to work in Firefox ? It basically fills a drop down with a
list of dates that a user can select. Code:
View 2 Replies
View Related
Dec 3, 2007
I need some help converting this VBScript over to JavaScript so that the calculations will work properly in browsers other than IE.
You can take a look at Turn 2 Design Code: for a feel about what I'm trying to do, but basicly, I just need to calculate the cost of the selected items based on the selected quantity of that item.
The only thing I know about JavaScript is the small Pop-up scripts I've been able to litterally copy and paste to implement. So, please, dont just post code, post an explaination of whats going on and why so I can try to figure it out. Code:
View 8 Replies
View Related
Mar 21, 2005
Not sure whether this should go in the JavaScript or VBScript/ASP section, but I'll try here anyway.
I have an ASP include file that contains both VBScript and JavaScript code. The VBScript processes some information and has an onChange event which calls a JavaScript function. Within this javascript function I want to access a recordset and retrieve a value using a variable from the javascript. Here's the code from the JavaScript section. Code:
View 1 Replies
View Related
Sep 30, 2000
Just wondering if anyone knew if there was a definite speed advantage to VBScipt as opposed to JavaScript?
View 7 Replies
View Related
Mar 28, 2007
I'm looking to return DATE ONLY for yesterday's date. No seconds,
milliseconds. Formatted either yyyy/mm/dd or mm/dd/yyyy. VB does it so
easily Date()-1 will return 03/27/2007 if today is 03/28/2007. Why so
many hoops for javascript? Any ideas?
View 21 Replies
View Related
Jul 20, 2005
I have the following function to get the total qty:
function calttl()
{
var ttlqty
ttlqty=0
for (i = 0; i <= document.qtymain.orderdetail.length-1; i++)
{
ttlqty = ttlqty + document.qtymain.qty.item(i).value
}
}
The problem I have is the document.qtymain.qty.item(i).value I get
look like a string, so the number I get for ttlqty is not add up the
number but concatenate.
How do I convert the value I get to a number in javascript?
View 8 Replies
View Related
Feb 4, 2005
I'm having a problem getting javascript and vbscript to place nicely together. Here is what I want to do:
I'm getting values from my database for different exam types. Here are some sample values:
Exam Type1
Exam Type2
Exam Type3
Here is how I get the values in vbscript: Code:
View 5 Replies
View Related
Jul 23, 2005
I got two ASP pages. One is ASP email form (I'm using Persist ASP
Email component). Another one has all file links in it. For example,
when user click Outlook course hyperlink. It will pop up another
window with outlook course PDF file. (All PDF files are already in the
server).
What I am trying to do is: When user click the "Add Email" hyperlink,
it will add that course name and filepath into ASP/VBScript Dictioanry
Object. After the user finish and click "Attach to email" button. All
the files will be attached in the email as an attachment.
Because I am not familar with VBScript. So, can Javascript add items
to ASP Dictionary Object?
View 3 Replies
View Related
Mar 17, 2002
Has anyone got any pros and cons for using Javascript over VBscript or vice-a-versa, Code:
View 7 Replies
View Related
Nov 3, 2005
Can anyone redirect to any online tutorials, articles, code of how to upload a file using HTTP PUT method and JavaScript or VBScript to a server running Apache 2.0 that uses CGI + PERL.
How to create configuration entries in httpd.conf for supporting HTTP PUT method.
How to code with AJAX to post uploaded file content to the server using PUT method ?
View 1 Replies
View Related
Mar 28, 2005
Can I use javascript to create a menu. then insert the value to it? I mean.. If i got 1 page, and 1 textbox. can I pass in the value in the textbox to a vbscript Msgbox or Menu, then i change the value in Menu, maybe use combo box or listbox. then i select it and click ok, the value in my page can get it and chage the default value? Thank!
ps: I want a pop up "menu", not a pop up "window"... or maybe in Vb6 we calll a form
View 2 Replies
View Related
Jul 23, 2005
I am learning HTML for the first time taking a self teaching class
though my local Community College. Normally this college rocks and has
some of the best resources and down to earth teachers that pick books
that acutally help folks.
Well they failed and my book take more logic jumps that Stephen
Hawkins! :D
So my ultimate question is as follows:
How do I created a function with the following information provided:
Create a fucntion named Mquote that contains the single parameter,
Qnum.
My apologies for such little information. I am sure its my oversight
that I am unable to locate the answer to my question.
What I am looking for is the base layout for noob java functions.
View 7 Replies
View Related
Apr 18, 2006
Can javascript functions have variable number of arguments - a concept
known as paramarrays?
View 15 Replies
View Related
Sep 21, 2007
I have some javascript functions in an xslt file. Everything works and produces the desired html, except when using the visual studio debugger which gives the error "objects of type 'Script1' do not have such a member" and references the line and column where the "this" object is used, as in this.hourarray()
View 1 Replies
View Related
Dec 18, 2001
I wrote a funtion for all my <a href=...> tags. If I use the function, it looks like this:
<a href="test.html" onFocus="myfunction()">
What I want is to automatically add myfunction() to all the links on a page. So I don't want to add onFocus=blablabla each time when I link to another page.
View 5 Replies
View Related
Jan 30, 2007
I have this code:
Code:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<script language="javascript" >
function outer(data)
{
var operand1 = data;
function inner(operand2)
{
alert(operand1 + operand2)
}
}
</script>
<body>
//<input type="button" value="1" onclick="outer(3)(2)" />
//<input type="button" value="2" onclick="outer(3)(2)" />
<div id="target"></div>
</body>
</html>
How do I call the inner function and pass operand?
View 2 Replies
View Related
Jul 23, 2005
We have an applet that has to support the SUN VMs as well as the MS VM.
The applet receives updates from a server (via tcp or http) and wraps them
up as objects and passes them using the JSObject scripting context to a
javascript function.
This function takes the object and reads the properties and updates a
screen.
All seems simple stuff. The problem is that the MS JVM runs like a rocket,
but the sun vm seems to max out our processor and also takes ages to process
anything.
I have tried logging from the console using debug level 5, and it shows a
lot of back and forth between the applet and the javascript when accessing
methods on the object passed.
Seeing that as a possible problem, I now pass a delimited string to the
front end, and then convert that into an update message purely in javascript
so there is only one hit to the applet per message.
I am still seeing a massive difference between the sun and ms VMs.
Has anyone ever come across this, and is there anything I can do to help
flatten out this performance?
View 1 Replies
View Related
Apr 1, 2006
Might there be a way to add a set of Javascript functions to a display page's existing set of Javascript functions on the fly without reloading the display page, and if so, how?
A couple of approaches I have tried, but without success are:
- A) For an embedded "retriever" IFrame in the display page to retrieve a set of JS functions from the server and then on its "onload" transfer (by innerHTML transference) that set of functions into the parent display page.
- B) Similiar to "A" but to use regular old browser frames - one being the "retriever" and one being the display page.
- C) Using a JS function in the display page to make a http request for a supplementary .js file(s).
Please note: the goal is to retrieve *only* an additional set of Javascript functions from the server, and then add them to an "original" set of functions already loaded into the browser. Meaning, NOT - say - for an IFrame to download from the server *both* the additional set and again the "original" set, which the parent display page could then run directly from the IFrame.
After "A", "B", and "C", I'm at a loss for further ideas.
View 2 Replies
View Related
Dec 5, 2007
I have a form with 2 submit buttons, "Test" and "Save".
I also have to javascript functions, "TestImage" and "SaveImage".
What I want to do is, when the "Test" button get's clicked, then execute the "TestImage" function. That was easy, I did it like this:
<input type="submit" name="test" value="Test" onClick="return TestImage(this);">
But what I also want is, when someone clicks on the "Save" button, to first execute the "TestImage" function, and then the "SaveImage" function. Anyone know how I can do this?
View 7 Replies
View Related
Sep 29, 2005
Just wanted to share two handy RegEx expressions to strips leading and
trailing white-space from a string, and to replace all repeated spaces,
newlines and tabs with a single space.
* JavaScript example:
String.prototype.trim = function() {
// Strip leading and trailing white-space
return this.replace(/^s*|s*$/g, "");
}
String.prototype.normalize_space = function() {
// Replace repeated spaces, newlines and tabs with a single space
return this.replace(/^s*|s(?=s)|s*$/g, "");
}
" one two three
".trim(); // --> "one two three"
" one two three
".normalize_space(); // --> "one two three"
View 5 Replies
View Related
Mar 22, 2007
i am having trouble understanding what the difference is
between BLUR and FOCUS. I need to include these functions in my form
and i am unsure what these features do and how i incorporate these
into my form.
View 6 Replies
View Related
Mar 20, 2006
Are there javascript functions to find the cursor position of a mouse? Also, are there javascript functions to find if the mouse cursor is within a listbox? A C# code sample is shown below:
Listbox lb; //lb is a listbox
Point cpos = lb.PointToClient(Cursor.Position); //find coordinates of mouse
if(lb.ClientRectangle.Contains(cpos)) //if mouse cursor is within the listbox
Are there any javascript functions which can do the same as the above c# methods?
View 1 Replies
View Related
Nov 4, 2005
I wrote some prototype functions in my code for arrays this is one of them !
Array.prototype.inArray = function(value){
for (var x in this) {
if (this[x] === value) {
return true;
}
}
return false;
};
when I iterate through array .. I get this functions as values in array !!!
can anybody explain this !?!?
View 11 Replies
View Related