|
Wheany posted:Try putting a breakpoint on the first row of closeIt (var count = 0). However, whenever I try to close the window, I always get the prompt. Using Chrome's javascript console, count is undefined. The treepanel is created in markup with a hidden root node. On the initial page load, it will always be empty except for the root. When a user makes changes, those changes are added to the tree panel. I put the closeIt method in the body's onload event, and then I do get that tpMods is undefined. Edit: I figured it out. Was a combination of a function code:
code:
Uziel fucked around with this message at 13:00 on Oct 10, 2012 |
# ? Oct 10, 2012 12:15 |
|
|
# ? Jun 6, 2024 07:07 |
|
What is codebehind?
|
# ? Oct 10, 2012 14:48 |
|
Suspicious Dish posted:What is codebehind?
|
# ? Oct 10, 2012 15:02 |
|
I'm writing an xfa script to hide all of the 8 fields with the same name on page 1 in a pdf. The code I want to use is:code:
|
# ? Oct 10, 2012 20:16 |
|
Just a guess, because I don't know anything about xfa script, but maybeJavaScript code:
|
# ? Oct 10, 2012 21:23 |
|
Yep that did the trick. Shine on you crazy diamond
|
# ? Oct 10, 2012 21:31 |
|
Does anyone know of something like Kendo UI (in terms of simplicity) that is a little more mature? I like how easy it is to develop with, but I'm finding too many bugs and lack of support for pretty important stuff (like nested JSON in your datasource). There's got to be something that's more mature yet just as easy to develop with. Any ideas?
|
# ? Oct 15, 2012 12:58 |
|
My Rhythmic Crotch posted:Does anyone know of something like Kendo UI (in terms of simplicity) that is a little more mature? I like how easy it is to develop with, but I'm finding too many bugs and lack of support for pretty important stuff (like nested JSON in your datasource). There's got to be something that's more mature yet just as easy to develop with. Any ideas? and/or http://ext.net/ I use ext.net and their support is really good even for the community license
|
# ? Oct 15, 2012 13:30 |
|
Uziel posted:http://www.sencha.com/products/extjs
|
# ? Oct 15, 2012 13:50 |
|
I'm trying to use the appendChild method and loops to automatically create a table with 1000 rows and 1000 columns. My code only creates a single row with 1000 columns. What am I doing wrong?code:
|
# ? Oct 17, 2012 01:18 |
|
You're using the 'i' variable for both loops! Oh no!!! Name the inner loop's variable 'j' or something else. (Also, you've got an off by one; that builds 1001 of them.)
|
# ? Oct 17, 2012 01:26 |
|
Ahhhh, forgot about the rules of scope. Thanks!
|
# ? Oct 17, 2012 01:31 |
|
Also, it looks like you make a local variable "table" at the start of your code, then use a global variable "i". Assuming you only changed your inner loop to use j instead of i, you also use a global variable there.
|
# ? Oct 17, 2012 03:56 |
|
Wheany posted:Also, it looks like you make a local variable "table" at the start of your code, then use a global variable "i". Sorry, I'm not following. As I understand it, "table" is global and "i" and "j" are both local (since they only exist inside the loops). Is this not correct? What are you saying needs to be changed?
|
# ? Oct 17, 2012 15:00 |
|
JavaScript doesn't have block scope. It has function scope. So there's "globals", which are visible to the entire program, and "locals", which are visible to the current function. Forgetting to declare a variable with "var" before using it means you've made a global instead of a local.
|
# ? Oct 17, 2012 15:11 |
|
Ah, I forgot var in front of i. Okay. So if I had put var in front of both "i"s in the first place, would I still need to change the inner i to j?
|
# ? Oct 17, 2012 15:18 |
|
JavaScript code:
JavaScript code:
|
# ? Oct 17, 2012 15:24 |
|
I would think so, because...code:
Edit: Also that. One weirdness about JS I learned from Crockford is that it internally moves variable declarations to the top, leading to weirdness if you were operating on the assumption that they were being declared in place. Golbez fucked around with this message at 15:35 on Oct 17, 2012 |
# ? Oct 17, 2012 15:25 |
|
Excellent, both of those answers help clear it up. The problem I'm having is that I'm learning both JS and PHP at the same time, as well as doing some basic VB.NET at work. A hazy understanding of three different languages leads to some serious mix ups.
|
# ? Oct 17, 2012 16:07 |
|
Golbez posted:
When you use a var declaration, the variables you declare have function scope. So this: JavaScript code:
JavaScript code:
JavaScript code:
JavaScript code:
JavaScript code:
code:
|
# ? Oct 18, 2012 09:25 |
|
caiman posted:Excellent, both of those answers help clear it up. The trick is that Javascript's var keyword does the exact opposite of PHP's global keyword, since PHP assumes local, and Javascript assumes global. (PHP's design is probably superior in this aspect, I can't count how many times I've polluted global in JS.)
|
# ? Oct 19, 2012 01:58 |
|
I ran into this interesting problem at work. A coworker told me you couldn't edit the <head> tag after a page had loaded. I didn't believe him so I set up the following test:code:
If both were available I could just assume my coworker is wrong (this works in all 3 browsers as far as I can tell) and if neither showed up I'd assume he was right. Since only one of the items shows up I have no idea what's going on now. Anyone have any ideas why this behavior happens?
|
# ? Oct 19, 2012 05:34 |
|
Atom posted:The trick is that Javascript's var keyword does the exact opposite of PHP's global keyword, since PHP assumes local, and Javascript assumes global. (PHP's design is probably superior in this aspect, I can't count how many times I've polluted global in JS.) Which is why you always use strict mode and jslint or jshint. And more functions. MrHyde posted:I ran into this interesting problem at work. <snip> Anyone have any ideas why this behavior happens? My guess is that for security reasons you might not be able to access script tags maybe? But you definitely can edit the head tag. That exactly how for example LESS works. Also, please use console.log instead of alert if you must dump the state of some variable.
|
# ? Oct 19, 2012 08:04 |
|
jQuery does not really insert script elements for IE compatibility reasons. It evaluates the code instead. Relevant source code: https://github.com/jquery/jquery/blob/2defcf96e571728b0a565527a532feb30466ebf4/src/manipulation.js#L333 https://github.com/jquery/jquery/blob/2defcf96e571728b0a565527a532feb30466ebf4/src/manipulation.js#L629 https://github.com/jquery/jquery/blob/2defcf96e571728b0a565527a532feb30466ebf4/src/manipulation.js#L689 Gazpacho fucked around with this message at 08:30 on Oct 19, 2012 |
# ? Oct 19, 2012 08:08 |
|
That would make sense if he actually inserted the script tag with jQuery. He doesn't. EDIT: oh, nevermind. He does insert the script tag with jQuery, yeah. Try document.head.appendChild instead.
|
# ? Oct 19, 2012 14:53 |
|
Golbez posted:I would think so, because... Random question, but did you by any chance attend the Web Directions conference in Sydney last week?
|
# ? Oct 21, 2012 23:26 |
I'm trying to write a Greasemonkey script that will convert Arabic/Farsi text from Arial to Tahoma. Is there a simple way to detect if body text is in Arabic or Farsi?
|
|
# ? Oct 22, 2012 01:44 |
|
Gnack posted:Random question, but did you by any chance attend the Web Directions conference in Sydney last week? I wish I'd been in Sydney, no.
|
# ? Oct 22, 2012 20:45 |
|
e: I need to learn not to reply to things I don't know anything about.
Gazpacho fucked around with this message at 02:07 on Oct 23, 2012 |
# ? Oct 23, 2012 01:56 |
|
Any recommendations for a good OSX IDE for Node? I don't expect there is a lot out there. Syntax highlighting would be nice, code folding would be nice, autocompletion would be stellar but I'm not expecting much.
|
# ? Oct 23, 2012 03:45 |
|
Zombietoof posted:Any recommendations for a good OSX IDE for Node? I don't expect there is a lot out there. Syntax highlighting would be nice, code folding would be nice, autocompletion would be stellar but I'm not expecting much. Sublime Text!
|
# ? Oct 23, 2012 07:21 |
|
MacVim with a JSHint plugin?
|
# ? Oct 23, 2012 12:27 |
|
Zombietoof posted:Any recommendations for a good OSX IDE for Node? I don't expect there is a lot out there. Syntax highlighting would be nice, code folding would be nice, autocompletion would be stellar but I'm not expecting much. WebStorm. Its made by the jetbrains guys and its built specifically for js/node
|
# ? Oct 23, 2012 12:43 |
|
Going to give WebStorm a try, thanks! I can definitely get the $29 student license if I like it.
|
# ? Oct 23, 2012 22:41 |
|
Can I actually stop the loading of page elements with javascript? I have made a user script for the PYF gif thread that convert img tags in read messages to links. That works, but the original purpose was to not even load all the gifs in the read posts. Well, looking at the network tab in the debugger shows that the images are still being downloadad This userscript is made for Opera, but can be easily made to work with Greasemonkey and Chrome as well. The original code is in the readReplacer function, but that runs only after the DOM content has loaded. So my second idea was listening to DOMNodeInserted and intercepting the body tag and then the image tags inside it. Except Opera does not fire a DOMNodeInserted for body or any tags inside it (in the first pass?). document.body just appears suddenly. That's why I'm testing for document.body in loadingReplacer. So my next idea was using Opera's user script specific functions, and to listen to BeforeEvent, which fires before any actual events. Except document.body suddenly simply materializes there as well. So I tried one more thing. First I replace all the read images with links, then stop page loading (window.stop()), then I reset the remaining image srcs. The theory was that it would resume loading the images. Except it never even stops loading them. So here is the resulting trainwreck of code: JavaScript code:
JavaScript code:
|
# ? Oct 25, 2012 20:46 |
|
It looks like the next two weeks at work I need to work on a Node.js program with custom C++ classes. What's the recommended IDE/debugger for such a beast? Bonus points if I can set a break point in JS and step into the C++ and back out again with the return value.
|
# ? Oct 26, 2012 04:16 |
|
this is not a question at all, but I personally have been working on a home javascript app and I was really struggling with how to unittest. Ended up going with a combination of qunit and js test driver using the qunit to js test driver adapter and I think it looks great. It's a little harder to write "good" unit tests for ajax that work on both regular qunit (nice in-browser test runner) and js test driver (for continuous integration build failing), but I think I "iteratively developed" something there that I'm happy with. So figured I'd share that if you're doing java, and need unit tests I think qunit and/or js-test-driver could work for you. repo after making that change for seeing how I combined it, but nothing that makes sense without some amount of background knowledge in qunit/js test driver edit: for IDEs, I'd say WebStorm since I'm a huge Pycharm user (which does all the javascript stuff too) and like Jetbrains products.
|
# ? Oct 29, 2012 04:55 |
|
I'm trying to get a function called every time a checkbox is changed and it's driving me nuts. This is my code: code:
code:
EDIT: It tells me this: code:
Boz0r fucked around with this message at 11:02 on Nov 5, 2012 |
# ? Nov 5, 2012 10:48 |
|
Boz0r posted:I'm trying to get a function called every time a checkbox is changed and it's driving me nuts. code:
1) You call the function OnChangeCheckbox with this. 2) you then call the function onclick (which is probably null) of checkbox with whatever OnChangeCheckbox returned (which is probably undefined, or because it looks like OnChangeCheckbox is undefined when you call it, it will just throw an error) What you probably want is to declare OnChangeCheckbox first, then assign: checkbox.onclick = OnChangeCheckbox; And for the love of god, use console.log instead of alert if you need to dump some variable. e: And when OnChangeCheckbox is called after checkbox.onclick, this will point to the checkbox. Wheany fucked around with this message at 12:55 on Nov 5, 2012 |
# ? Nov 5, 2012 12:53 |
|
|
# ? Jun 6, 2024 07:07 |
|
In other words, you don't want to call the function as an argument of onclick, you need to assign the function to onclick. Right?
|
# ? Nov 5, 2012 18:36 |