Search javascript

136304 results
3

votes
1

answer

Javascript Excel OpenFile

I have this code: function test() { var Excel = new ActiveXObject('Excel.Application'); Excel.Workbook.Open('teste.xlsx'); } So the main problem is I keep getting this error: On line 7 , Unable to get value of property Open URL file:///C:/users/admin/desktop/test.hta
PythonNewbie
2

votes
2

answer

JavaScript set cookies

I'm a bit stuck on some javascript. So the script below sets eith one of two cookies. If the page contains 'lpt' and a cookie called organic doesn't exist (not sure if the second part actually works) then create a cookie. Otherwise create a different one. Problem is which ever cookie is created need...
SamualG
2

votes
3

answer

Calling VBScript from Javascript

I've seen the related post on this, but it only covers using inline VBScript for onmouseover events, while calling a Javascript Function for the onClick. Is there a way to call a VBScript Sub for the onClick event from a button that uses Javascript onmouseover and onmouseout events? Currently whe...
1

votes
3

answer

javascript array and objects

How can I convert two arrays to the object? My arrays: arr1.push(3,2,3,6,11,7); arr2.push('num1','num2','num3','num4','num5','num6'); How to convert it to the object: [{name:'num1', value:3}, {name:'num2', value:2}, {name:'num3', value:3}, {name:'num4', value:6}, {name:'num5', value:11}, {na...
user889349
1

votes
1

answer

Javascript - iterating throught array

Hi i have following code $(args.data0).find('group').each( function() ... Variable args is create by AJAX call and it contains data0, data1, ... dataN How can i programatically iterate over all these variables? Something like that packed in some kind of forEach cycle :) $(args.data0).find('group').e...
user1453857
12

votes
4

answer

Show javascript execution progress

I have some javascript functions that take about 1 to 3 seconds. (some loops or mooML templating code.) During this time, the browser is just frozen. I tried showing a 'loading' animation (gif image) before starting the operation and hiding it afterwords. but it just doesnt work. The browser freezes...
Midhat
2

votes
3

answer

Get url with javascript

I want to get the url with javascript. But I just need http://www.mysite.com, without any parameters behind it. any idea how to get that?
Artjom Zabelin
2

votes
1

answer

Weird loop in Javascript

Why is continue not executing just once? var flag = true; for (let tab of tabs) { if (tab.url == 'about:blank') { if (flag === true) { console.log('came'); continue; } flag = false; } tab.close(); } But instead, every time the first condition tab.url=='about:blank' is true, it's like it doesn't eve...
cipher
17

votes
2

answer

Javascript String.fromCharCode Case Sensitivity?

I am simply listening for a keyup event of an input element and gather the results into a string like so word=word+String.fromCharCode(key.keyCode); The problem is that the word is in capital letters while I want it to be case-sensitive. For example if I type abcef my accumulated word becomes 'ABCE...
Joel_Blum
1

votes
1

answer

lexical scoping in javascript

I'm reading this book: http://eloquentjavascript.net/ which I think is brilliant. However I'm having difficulty understanding the following function, where does the function add(number) get its argument from? function makeAddFunction(amount) { function add(number) { return number + amount; } return...
john mossel
2

votes
2

answer

Google Analytics javascript

Here is a Google Analytics' code var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-20366831-2']); _gaq.push(['_trackPageview']); (function () { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl'...
Olev
2

votes
4

answer

javascript HTML from document.body.innerHTML

I am trying to build a string of the contents of a webpage, without HTML syntax (probably replace it with a space, so words are not all conjoined) or punctuation. so say you have the code: Content: paragraph 1 paragraph 2 alert('blah blah blah'); This is some text ....and some more I want to retur...
Test Tester
2

votes
3

answer

opening Outlook through javascript

Does anyone know how to open Outlook using Javascript? I am getting an exception (in IE6) while using this code: var outlookApp = new ActiveXObject('Outlook.Application');
Wondering
1

votes
2

answer

Javascript cookies creation

When creating a cookie using javascript using document.cookie document.cookie = name + '=' + value + '; ' + expires + ';path=/'; will the domain be populated or do I need to specify it?
Tad
1

votes
1

answer

Inject Javascript in GWT

When I inject javascript this way: ScriptInjector.fromString('var WRInitTime=(new Date()).getTime();').inject(); ScriptInjector.fromString(Resources.instance.clicktaleScript().getText()).inject(); I can see that the script injected was in a IFRAME. What is the GWT approach in injecting Javascript co...
xybrek
14

votes
3

answer

JavaScript Function Context Incorrect

I noticed a weird thing in javascript. Consider the below: var fn = ''.toUpperCase.call console.log(typeof fn); // 'function' fn(); // Uncaught TypeError: `fn` is not a function The above was executed on my Chrome's Developer Console. Version is 43.0.2357.81 m. The typeof operator clearly shows that...
Amit Joki
1

votes
2

answer

Javascript newbie question

i am using a jquery plugin to upload files, the plugin checks the file dimension and return back the appropriate error message. the error message i am displaying is with this code. $('#divmsg6').append('Incorrect file dimension, try again'); now if the user keep on trying the error will keep on appe...
Ibrahim Azhar Armar
3

votes
5

answer

Javascript basics: variable scope

I am learning javascript and can someone please explain the following code snippet for me? var state=true; function bob(){ var state=false; } bob() What should be the state value and why? Many thanks, L
lshettyl
4

votes
2

answer

Making javascript animation smooth?

Basically what I want to achieve is to drag some div within another container div. Inner div should stop when it reaches the boundaries of the container div. I managed to do the most parts. But the problem is that if I drag inner div slowly & carefully it stops where it is supposed to be on the edge...
Odgiiv
1

votes
4

answer

javascript map all paths

im not able to figure out the following problem. At point 1 I could either go to point 2 or point 5. From point to I could go to 3 or 4. From point 5 I could go to 6 or 7. From 7 there is only one path to 9. I would like to calculate all the full paths. Im not looking for the fastest route or anythi...
user1416256
6

votes
1

answer

Basic Javascript Regex

I'm trying to learn javascript Regex and I've hit a problem. I'm trying to validate with the following rules. Allow only: Numbers 0-9 ( ) + - (space) I have come up with the regex below to handle this: /[0-9\)\(\+\- ]+/i The following matches but shouldn't do because it contains a @ symbol: [email protected]
SkelDave
1

votes
4

answer

Enabling Client Side Javascript

I want to know that if it is possible to enable JavaScript on client side browser e.g if most of the functionality of my website is characterized by JavaScript and some of the viewers of my website have disabled JavaScript, how can I enable it rather then the client is asked to turn JavaScript on? I...
Awais Umar
1

votes
1

answer

JavaScript: requestAnimateFrame get faster

I have an animation with requesetAnimationFrame And when I replay it, it gets faster and faster until it gets invisible. function tirer(){ var missile=document.getElementById('missile'); var currt= missile.currentStyle ||window.getComputedStyle(missile); if ( parseInt(currt.bottom)
unfoudev
1

votes
3

answer

Python Scraper for Javascript?

Can anyone direct me to a good Python screen scraping library for javascript code (hopefully one with good documentation/tutorials)? I'd like to see what options are out there, but most of all the easiest to learn with fastest results... wondering if anyone had experience. I've heard some stuff abou...
Diego
1

votes
2

answer

Javascript in Machine Language

Is it possible to convert javascript code to machine code or pure native binary?
SamSol
1

votes
2

answer

ASP.NET Javascript Error :: sys.webforms.pagerequestmanagerservererrorexception

I have an ASP.NET site that uses JQuery and ASP.NET UpdatePanel and ScriptManager. On one page in particular, I get a javascript error: sys.webforms.pagerequestmanagerservererrorexception: Index and length must refer to a location within the string. Parameter name:length ScriptResourse.axd Code:...
Andy Evans
-1

votes
0

answer

Netbeans 8.2 JavaScript

I downloaded NetBeans 8.2 and tried to make a JavaScript project. However it doesnt show me an option to make a JS project, not even an HTML project or PHP project. How do I get it to allow me to make a JavaScript project?
shieldgenerator7
1

votes
1

answer

Form Clear/Submit Javascript

So I have a HTML form, I need to clear the form inputs when a key is pressed and default content gets deleted as well. If reset is clicked, the form resets to its default 'Enter ect' and you have to input something again. Also, if submit is clicked without one of the fields entered, it should displa...
ahlie94
1

votes
1

answer

Method .click() in JavaScript

I have this textarea: And I use it with the script: document.getElementById('updElement').onchange = function () { var l = document.getElementsByClassName('dijitTreeRowSelected'); l[0].click(); }; So when I change manually the textarea by adding some symbols, my script is running. But my problem is,...
Ess
1

votes
4

answer

Efficiency of Javascript functions

Q1. I would like to confirm whether Version 1 of below code is more efficient than Version 2? I'd like to know for future reference so I will be writing codes according to the style of either V1 or V2. Q2. How does one measure efficiency of the code? (Doesn't have to be in depth, I just want to hav...
Lina
1

votes
4

answer

javascript eval method

How can I watch variable values inside of javascript eval() method? And is it possible to 'step into' and 'step over' in eval method? For example, with a code like this: eval('if (true) { var a = 10; a += 20; alert(a); }'); I am more interested in debugging in IE9, but I would like to hear general p...
1

votes
6

answer

JavaScript IF statement problem

I have a problem writing an if statement, due to my lack of programing skills. there's the code : $('div.footerMenu li div.onScreen').click( function(e) { e.stopPropagation(); e.preventDefault(); return false; } ); Inside this div I have simple links. And the problem is, when i click on that lin...
Szymon
1

votes
2

answer

“Done” function in javascript

For example, I read Grunt documentation on Creating Tasks. In 'Tasks can be asynchronous' section, there is a use case of 'done' function, I wonder why do we need that. grunt.registerTask('asyncfoo', 'My 'asyncfoo' task.', function() { // Force task into async mode and grab a handle to the 'done' fu...
Great Question
1

votes
1

answer

Javascript: Return sliced elements

I have used the .slice() function within my code to slice an array of 10 elements that I get from the response of an API request (.get), this allows me to show 9 out of the 10. But, I would like to return the 10th element when I click on a button. For example, if the API request has a total of 19 e...
Aadil Hafesji
1

votes
5

answer

Javascript regular expression

string = 'Hello 1234_ world 4567_ trap 456'; I need to capture all digits followed by underscore. Following code will do. string.match(/(\d+?)(_)/gi); However I tested following code and it worked except that underscore was also being captured. (\d+)_ So I decided to give underscore its own capture...
Nick Vanderbilt
1

votes
1

answer

Javascript XML parsing [closed]

What is the best JavaScript library to parse XML/RSS/Atom feeds? Is there something like Python Feed parser but then for JavaScript ? thanks, Pero
Perica Zivkovic
1

votes
2

answer

JavaScript onclick Event Problem

Let me start off by saying my JavaScript skills are lacking, to say the least. I have been having a problem with the following function: function setClickHandler(element) { element.onchange = function () { var id = this.options[this.selectedIndex].value; if(document.getElementById(id) !== null){ cli...
Chad
1

votes
2

answer

JavaScript: jQuery Tab charCode

I was trying to figure out what the jQuery returns in the event.which, event.keyCode, event. during the blur event when I use tab key. Is it not supposed to return 9?. I also tried with the keypress but it does not recognize it. http://jsfiddle.net/LvDGP/2/ Am I doing something wrong?
felix
1

votes
2

answer

Referencing objects in Javascript

When you have a multi-tiered object like a json object that say has 3 tiers i = {'id':1{'name':'austin', 'lives':'college'{'name':'eckerd', 'major':'compsci'}}} To reference the object is it better to reference it like so for (x in i) i[x]['lives']['name'] //or i[x].lives.name I think that gets my i...
austinbv
1

votes
2

answer

Razor + Javascript weird error

I saw a very very weird error at my razor codes see the following code: @if (Model.SomeVerification) { if (startHour.getTime() >= maxStartHour.getTime() || startHour.getTime() < maxStartHour.getTime()) { if (!(checkIN.valueOf() = checkIN.valueOf() ))
Luiz Carlos Lucena