jscript

word count method

I have recently used modified a word count method in javascript for my website, so that it counts the intial amount words in the textarea, but it doesn't quite work function wordCounter(field,countfield) { var maxlimit = 200; var wordcounter = maxlimit - information.value.split(' ').length; for (x = 0; x < field.value.lengt...

Formatting floating point numbers in ASP

A friend asked me to update his shopping cart software. It's written in classical ASP using IE's JScript. I can't seem to format the variables correctly. . <% if (oOrder['product'] == "camera") { %> <%= format_float(oOrder['cost'], 2, 3)/2 %> <% } %> %> When I do this I get a bunch of jibberish with regards to the output...

Refresh/Restart Vista's graphical login screen using JScript (WSH)

Background: I have a JScript that runs when the computer starts up (from task scheduler). The script does some magic and determines if a user should be allowed to login at all. It starts by disabling all user accounts and then if a user is to be allowed in it enables the users account by firing the 'net user' command using wshShell.Exec(...

Exception line-number in Jscript-ASP

Hello all, I'm developing a website with server-side JScript engine over ASP server. I have several try-catch clauses in my code looking roughly like this: try { // do something } catch (err) { // pass it to the frontend code die("Exception caught: " + err.description); } I would very much like to display the line number in ...

Why is WSH giving me the "expected ;" error?

Im trying to get my feet wet with some WSH. I thought it was going to be easy, but it's really a nightmare... contents of registry.js > Set shell = WScript.CreateObject('WScript.Shell'); strRegValue = 'HKLM/Software/Microsoft/Windows/CurrentVersion/ProductID'; strPID = shell.RegRead(strRegValue); WScript.Echo strPID; This is ...

Setting a JScript variable to contentplaceholder

I have a content page in my ASP.NET-page and want to set a JScript variable to it programatically, so I can use it within the JScript sections of the rendered page afterwards. How can I start with this problem? I have a "head"-content that fills a ContentPlaceHolder in a master page, but have no idea how to write new content into it. I...

IE6: get value of a DOM select element

So I'm having a crossbrowser javascript issue. I've got a <select> dom element that has some descendent <option> element with selected=true. In Firefox, I can just do select_elt.value to get the value of the selected option, but this seems not to work in IE6 (which I need to support). I tried to iterate through the select_elt.getEleme...

What software I'll need to become proficient in the Microsoft endorsed languages?

I have a free MSDN account and now that I am proficient in C/C++/Java, and know some JavaScript, PHP and MySQL, I want to learn some proprietary languages from Microsoft. I am looking to experiment with everything within the next several months - C#, ASP, VB, things I haven't even heard of [insert suggestions here], what have you. Howe...

Disable events triggered on HTML <SELECT> control

Is there a way to capture the events triggered on HTML controls before they are forwarded for default (generic) handling by the control itself. In my case, I want to prevent a element dropdown to open when a user clicks on the control. e.g. On this user click, OnClick() event gets fired and is handled by the default control which open t...

How do I print the list of registry keys in HKCU\Environment to SDTOUT using JScript (WSH)?

I want to iterate over the environment keys and print a list of these items. ...

dropdownlist value not passed .net

i am working on an already built program with a lot of classes and jscripts. the issue is the code has 3 dropdownlist's month, date, year. I need to remove the date one and passa static "01" value. here's the code for validating date in javascript - function Validate_date(sender, args) { var m = document.getElementBy...

Using window.name as a local data cache in web browsers

I was reading about cookies and other related client-side storage options, and read about using window.name as a data cache of sorts: http://en.wikipedia.org/wiki/HTTP_cookie#window.name While it certainly has things that make it less desirable - and I won't sugar coat it, it is definitely a hack in the most true sense of that word - i...

Overloaded function in classic asp JScript

Is it possible to have an overloaded function in classic asp JScript ...

Haacked JQuery Undoable "Object doesn't support this property"

I refer to Phil Haack's "Undoable" article found here: http://haacked.com/archive/2010/01/01/jquery-undoable-plugin.aspx I've copied the exact mark-up for the table from the tables demo page, included JQuery 1.3.2 min, and copied the exact script block used on the demo page but when it gets to this bit: $('a.delete').undoable({ inline...

Capturing output from WshShell.Exec using Windows Script Host

I wrote the following two functions, and call the second ("callAndWait") from JavaScript running inside Windows Script Host. My overall intent is to call one command line program from another. That is, I'm running the initial scripting using cscript, and then trying to run something else (Ant) from that script. function readAllFromAny...

Returning Array from ActiveX component to JavaScript

I have an ActiveX component (which I did not write and have no control over). It has several methods I want to use, which return arrays. Every time I attempt to do something of the sort: var arrayValue = axObj.methodWhichReturnsArray(); the arrayValue object is undefined. The component provider tells me that I should not be having any...

Regarding Microsoft API: IHTMLWindow2::execScript Method

In MSDN, it is decleared as in http://msdn.microsoft.com/en-us/library/aa741364(VS.85).aspx : Syntax HRESULT execScript( BSTR code, BSTR language, VARIANT *pvarRet ); Parameters code [in] BSTR that specifies the code to be executed. language [in] BSTR that specifies the language in which the code is executed. The la...

How to put a date value as a number in a jscript array instead of using new Date(2008, 1 ,1)?

I have an array of dates that I am populating adding the dates creating the types and calling their constructor like this: new Date(2008, 1, 1) I was wondering if there is a better way to do this? I am guessing that I can use the numeric representation of Date and put that into the array on the server side and send this array down to th...

Best environment to do jscript development on Windows?

I would need to create some webpages that are using jscript and different jscript libraries heavily and I will need to write a littlebit of code and debug it through to see if that works. I would like to know if there is an IDE exists on Windows jsut to do this or there is a combination of tools that can be used for this purpose? ...

JScript runtime error: 'System' is undefined"

I have JScript method that is : function init() { var userid = System.Environment.getEnvironmentVariable("USERNAME"); setUserName(userid); } When I debug it , at first line of the init fuction, I'll get "javascript Microsoft JScript runtime error: 'System' is undefined". I'd be thankful if some one let me know how can I...