jscript

Instantiating a System.Threading.Thread object in Jscript

I'm trying to create a new System.Threading.Thread object using Jscript, but I can't get the constructor to work. If I just do the following, var thread = new Thread( threadFunc ); function threadFunc() { // do stuff } then I get error JS1184: More than one constructor matches this argument list. However, if I try to coerce thr...

How do you set up your JScript (NOT JScript.NET) development environment?

In my environment, if I create a class in JScript syntax: class test{ } and then save it to a file named "test.js" and run it with wscript, I get a Microsoft JScript "Syntax error" at line 1. However, if I simply, say, write a function: function getInput() { var wshell = WScript.CreateObject("WScript.Shell"); wshell.Popup...

Microsoft JScript runtime error: Object expected

Something wrong with this line of code: changeimage('image1', 'Photos/Customers/Test1/Dock.jpg') What is wrong? Edit: Javascript: function changeImage(image_name, image_src) { document[image_name].src = image_src; } Debug <img id="ctl00_Main_gridThumbnails_ctl06_tb1" src="Photos/Customers/Test1/Forest-tn.jpg" style="border-...

VBScript and JScript seem to handle element.click method in a different manner. Why?

Hi, guys. Here's another sample script in VBScript. It opens internet explorer, navigates to google, sets up a search field and submits a query. set ie = CreateObject("InternetExplorer.Application") ie.navigate("www.google.com") ie.visible = true while ie.readystate <> 4 wscript.sleep 100 WEnd set fields = ie.document.getelemen...

Trouble defining method for Javascript class definition.

I'm somewhat new to object oriented programming in Javascript and I'm trying to build a handler object and library for a list of items I get back from an API call. Ideally, I'd like the library functions to be members of the handler class. I'm having trouble getting my class method to work however. I defined as part of the class bcObj...

Looping through JSON arrays

I'm trying to pull the field names in the header of some JSON output. The following is a sample of the JSON header info: {"HEADER":{"company":{"label":"Company Name"},"streetaddress":{"label":"Street Address"},"ceo":{"label":"CEO Name","fields":{"firstname":{"label":"First Name"},"lastname":{"label":"Last Name"}}} I'm able to loop th...

What language is used in Google Desktop gadgets?

The language Google Desktop gadgets use resembles JavaScript, but it's different in subtle ways. For example, I saw this line in a gadget: options(HISTORY_OPTIONS_NAME) = items_.join("|"); which looks like it's assigning to a function call. That's just not OK in JavaScript... what language is this? And what exactly is that line doing?...

Pass client side js variable into server side jscript

How can I get the query string from the browser url using client side js and set it as a variable to use in some server side scripting? Client side script: var project = getQueryString("P"); function getQueryString(param) { var queryString = window.location.search.substring(1); splitQueryString = queryString.split("&"); f...

What is the JScript version that's in IE9?

Title says it all. I want this for some conditional compilation code that will run in all IE's less than IE9. ...

ADO Execute not reading a line of SQL code?

My code is below: var statement = "test_oracle.sql"; F = aqFile.OpenTextFile(statement, aqFile.faRead, aqFile.ctANSI); F.Cursor = 0; while(! F.IsEndOfFile()){ s = F.ReadLine(); oResult = Project.Variables.oConnection.Execute_(s); The first line that "s" reads is: set serverout on size 10000 An error is returned as "OR...

ActiveX: Could not load Driver

Hello all, I am having a look at this example which makes use of activeX - it does extacly what I need from the description but everytime I try to run the example, I get the error: Could not load Drivers. The ActiveX Control could not be started. I have tried this on IE8 on a windows Vista Machine. What is the problem, how can I...

JScript: How to calculate difference between two date-times?

How can I calculate time difference in JScript between two times in milliseconds or seconds? For example, between 2010-04-23 15:03 and 2010-05-30 00:41 ...

Memory leak with Microsoft.JScript.Eval.JScriptEvaluate?

I'm evaluating some javascript with Microsoft.JScript.Eval.JScriptEvaluate() and I noticed from my memory profiler that there are a large number of System.String left allocated by Microsoft.JScript.HashtableEntry. Microsoft.JScript.Eval is a static class, does anyone know what class is holding these instances and how I can clear them? ...

Getting geographical coordinates from web application

I want to learn a user's location from his mobile device by web application. When user opens the website, with the help of a script we will learn if the device has a gps hardware.And if the device has gps hardware what are the current coordinates? I'm developing my project using ASP.NET Is this possible or not? Thanks. ...

What does the JScript IntelliSense error "Object expected @ 0:0" mean when compiling?

What does the JScript IntelliSense error "Object expected @ 0:0" mean when compiling with Visual Studio 2008? Error updating JScript IntelliSense: ascript.js: Object expected @ 0:0 Double-clicking the error drops the cursor into the aspx that has the reference to the script file. The script file is listed in the aspx in a script mana...

How do you read data from a ADODB stream in ASP as byte values?

I have an ASP routine that gets a binary file's contents and writes it to a stream. The intention is to read it from the stream and process it st the server. So I have: ResponseBody = SomeRequest (SomeURL) ; var BinaryInputStream = Server.CreateObject ("ADODB.Stream") ; BinaryInputStream.Type = 1 ; // binary BinaryInputStream.Open ; ...

How to decode javascript code within <Script LANGUAGE="JScript.Encode">

I would like to implement a Python script which has the same functionality as http://www.greymagic.com/security/tools/decoder/ Is the encoding rule open for this type of javascript code encoding? Thanks. An example of this: <Script LANGUAGE="JScript.Encode">#@~^TBQAAA==-mD~kk9P'8*R0%p\CD,wr[&fP{~xhPz..lH`EFTc+{W*v~Eq!W {*+B~vqZc+GW{E~v8...

JScript JSON Object Check

I'm trying to check if json[0]['DATA']['name'][0]['DATA']['first_0'] exists or not when in some instances json[0]['DATA']['name'] contains nothing. I can check json[0]['DATA']['name'] using if (json[0]['DATA']['name'] == '') { // DOES NOT EXIST } however if (json[0]['DATA']['name'][0]['DATA']['first_0'] == '' || json[0]['DATA'][...

Searching the Registry for a key - JavaScript

Hi All, Is there a way to search the Registry for a specific key using Windows Scripting Host? I'm using JavaScript (Jscript/VBScript?) to do so, and the msdn Library doesn't mention any such method: http://msdn.microsoft.com/en-us/library/2x3w20xf(v=VS.85).aspx Thanks, So here's an update to the problem: The problem is a bit more...

Which event handler to use to record leaving page - onunload or onbeforeunload?

Hi all, Having not any answers to my previous questions about using javascript to measure page turn times, I'm going to start writing my own code (!). To measure the length of tie it takes, I'm proposing dropping a cookie containing a timestamp when the user browses away from a page, then in a subsequent page, comparing that time with ...