jscript

Request.ServerVariables(“..”) returns undefined when assigned to a variable yet its value can be displayed via Response.Write(“..”)

ε祈祈猫儿з 提交于 2021-01-29 12:22:08
问题 I am trying to retrieve the user's IP address and assign it to a variable: var ipAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR") || Request.ServerVariables("REMOTE_ADDR") || Request.ServerVariables("HTTP_HOST"); Response.Write(Request.ServerVariables("HTTP_HOST") + "<br />\n\n"); // produces "localhost" Response.Write(Request.ServerVariables("REMOTE_ADDR") + "<br />\n\n"); // produces "::1" Response.Write(Request.ServerVariables("HTTP_X_FORWARDED_FOR") + "<br />\n\n"); // produces

Current charset of the windows script host

落花浮王杯 提交于 2021-01-28 19:32:02
问题 I write script (js or vbs, not significant) with Windows Script Host that creating .bat file. I want to convert ANSI string to OEM with ADODB.Stream I may get current OEM code page with Split(CreateObject("WScript.Shell").Exec("cmd /c chcp").StdOut.ReadAll, ":")(1) and then convent it to charset with http://msdn.microsoft.com/en-us/library/windows/desktop/dd317756%28v=vs.85%29.aspx. How I may get the current ANSI(script) charset? 回答1: The Windows codepage can be determined via WMI, by reading

How to merge 2 XML files in to one with #Java Script or #XSL ?

送分小仙女□ 提交于 2021-01-28 07:09:41
问题 I have 02 XML files, I need to generate a report with the data combination of both the files. either Out put as an HTML file or Single XML with using XSLT File1 <FitnessCenter> <Member id="1" level="platinum"> <Name>Kamal</Name> <Phone type="home">2921234</Phone> <Phone type="work">2581247-293</Phone> <FavoriteColor>brown</FavoriteColor> <MembershipFee>1000</MembershipFee> </Member> <Member id="2" level="silver"> <Name>Wasantha</Name> <Phone type="home">2934321</Phone> <Phone type="work"

how to create a class in classic jscript?

廉价感情. 提交于 2021-01-04 09:22:33
问题 how to create a class in classic jscript? (not jscript.net) And, how to reference this class?. I tried with class someclass { } but it does not work. 回答1: There are not classes as such, but here's a simple example of how to get basic object-oriented functionality. If this is all you need, great, but if you're after other features of classes, such as inheritance, someone more knowledgeable than myself will have to help. function SomeClass(n) { this.some_property = n; this.some_method =

ClassList.add() for multiple divs with same className - No jQuery

一个人想着一个人 提交于 2020-12-27 07:16:24
问题 I have a number of divs with the same className ( .example ). I'm attempting to add classes to the classList of each of them using vanilla JavaScript, and successfully do so, but only for the first div of which possesses the targeted className , as shown using the following code: <html> <body> <div class="example">content</div> <div class="example">content</div> <div class="example">content</div> </body> </html> var example = document.querySelector('.example'); if (className = ('.example')){

Using htmlfile COM object to access the .getOwnPropertyDescriptor() method of an object in WSH JScript

佐手、 提交于 2020-12-15 05:31:23
问题 In the comments of this question, I was told that the .getOwnPropertyDescriptor() method isn't supported in ES3 ..., so it probably isn't supported in JScript [either] and that is indeed what I see when trying to invoke that method in cscript.exe / wscript.exe : Object doesn't support this property or method However, the latest JScript version I'm using is 5.812 and according to this document, the method should be available in 5.8* JScript. The discrepancy has also been noted in this post,

What are the functional differences between JScript, JavaScript, and ECMA Script?

岁酱吖の 提交于 2020-12-03 07:35:57
问题 Long Question To start, I know ECMA Script is the standard, and JavaScript and JScript are implementations. I understand that all three have their own specifications maintained, and there are many, many engines, interpreters, and implementations, but my specific question is: Assuming the implementation of a perfect interpreter and engine for each of the three, what could you do in one that you could not do in another, or what would have different effects in one than the other two? I

Run a bat file from javascript

送分小仙女□ 提交于 2020-02-20 09:19:09
问题 I'm trying to run a bat file using javascript. I've tried using powershell but it didn't seem to work properly. Here is the code I tried: var oShell = WScript.CreateObject("WScript.Shell"); oShell.Exec("D:"); oShell.Exec("cd dir"); oShell.Exec("start user.bat"); I've also tried that: var oShell = WScript.CreateObject("WScript.Shell"); oShell.Exec("start D:\dir\user.bat"); Sometimes it runs, sometimes I get those errors "Expected hexadecimal digit", "Access is denied". I'm really confused. All

Run a bat file from javascript

若如初见. 提交于 2020-02-20 09:18:12
问题 I'm trying to run a bat file using javascript. I've tried using powershell but it didn't seem to work properly. Here is the code I tried: var oShell = WScript.CreateObject("WScript.Shell"); oShell.Exec("D:"); oShell.Exec("cd dir"); oShell.Exec("start user.bat"); I've also tried that: var oShell = WScript.CreateObject("WScript.Shell"); oShell.Exec("start D:\dir\user.bat"); Sometimes it runs, sometimes I get those errors "Expected hexadecimal digit", "Access is denied". I'm really confused. All

in JavaScript, when finished with an object created via new ActiveXObject, do I need to set it to null?

雨燕双飞 提交于 2020-02-03 10:25:28
问题 In a Javascript program that runs within WSH and creates objects, let's say Scripting.FileSystemObject or any arbitrary COM object, do I need to set the variable to null when I'm finished with it? Eg, am I recommended to do this: var fso = new ActiveXObject("Scripting.FileSystemObject"); var fileStream = fso.openTextFile(filename); fso = null; // recommended? necessary? ... use fileStream here ... fileStream.Close(); fileStream = null; // recommended? necessary? Is the effect different than