|
Lumpy posted:People who don't know javascript and try to write it w/o learning it hate javascript. Film at 11. Yea, pretty much this. I have no web programming experience at all so it's really frustrating. But more importantly GWT does everything I need, saves me time, debugging in Eclipse woowoo, etc.
|
# ? Nov 16, 2010 03:29 |
|
|
# ? May 17, 2024 18:01 |
|
Netbeans has an excellent JS debugger
|
# ? Nov 16, 2010 03:34 |
|
rt4 posted:Netbeans has an excellent JS debugger Hmm that's good to know and I'll definitely keep that in mind if I have to go down that route again. Are there any down sides to using GWT, though?
|
# ? Nov 16, 2010 04:40 |
|
almostkorean posted:Are there any down sides to using GWT, though? People like me get all stuffy in the javascript questions thread.
|
# ? Nov 16, 2010 04:54 |
|
Douglas Crockford posted:Google wants their Java to run anywhere, so they translate it into javascript.
|
# ? Nov 16, 2010 06:42 |
|
Munkeymon posted:You mention Firefox in the article, but even the latest 3.x doesn't seem to support Object.create() so you might want to explicitly mention which browsers (or just which JS engines) it's going to work on if it's that badly supported. Good catch! I didn't really think that through. I don't use Firefox and for some reason I thought the latest version supported Object.create.
|
# ? Nov 16, 2010 08:53 |
|
Lumpy posted:People who don't know javascript and try to write it w/o learning it hate javascript. Film at 11. There is always some people know Javascript quite well and still hate it based on past experiences.
|
# ? Nov 17, 2010 21:01 |
|
What's a good book to start with JavaScript? I was eyeing the Chrome Experiments site and got all giddy watching the neat little graphical experiments. I have a relatively strong programming background so I'd prefer if the book actually focused on the syntax and semantics of JavaScript instead of explaining programming from the ground up. Someone recommended me JavaScript: The Good Parts. Is it any good?
|
# ? Nov 20, 2010 15:23 |
|
Foiltha posted:Someone recommended me java script: The Good Parts. Is it any good? Yes. Buy it, read it, love it.
|
# ? Nov 20, 2010 17:55 |
|
Foiltha posted:Someone recommended me java script: The Good Parts. Is it any good? It is absolutely the best book on js there is.
|
# ? Nov 20, 2010 23:06 |
|
I am trying to create a help feature for a user entered form. When a user mouses over a '?' icon next to a input box it will fill out the input box with example data. is this possible? this is kind of how i did it in html for another page. php:<? <input type="text" value="0.0" onblur="if (this.value=='') this.value='0.0';" onfocus="if (this.value==this.defaultValue) this.value='';" onkeyup="auto_currency('MonthIncome')" id="MonthIncome" name="MonthIncome" /> ?> DholmbladRU fucked around with this message at 20:43 on Nov 30, 2010 |
# ? Nov 30, 2010 17:57 |
|
DholmbladRU posted:I am trying to create a help feature for a user entered form. When a user mouses over a '?' icon next to a input box it will fill out the input box with example data. is this possible? Yes, it is possible, but please please please don't put your event handlers inside your HTML. It makes baby programming jesus cry, and makes anyone who ever has to change your code unhappy. javascript goes in javascript files, not mixed in with your HTML. code:
Lumpy fucked around with this message at 19:56 on Nov 30, 2010 |
# ? Nov 30, 2010 19:53 |
|
thanks. i had to change the first line to ' $('#theIcon').mouseover(function ()' I assume thats correct. I am going to have about 10 of these input mouse over things on onepage, however most of them will need to be auto-filled(on mouse over) with different things. For example, phone number, address etc. Can I still accomplish this through a plugin? edit:nevermind figured out a solution. DholmbladRU fucked around with this message at 08:07 on Dec 2, 2010 |
# ? Dec 2, 2010 03:42 |
|
DholmbladRU posted:thanks. i had to change the first line to ' $('#theIcon').mouseover(function ()' I assume thats correct. You know what's nice? SHARING your solutions so people can learn, or if next week somebody has the same question, they can see what you did instead of saying "Boy, I really wish that guy had actually told us what he did that worked instead of just saying 'nm, fixed it'".
|
# ? Dec 2, 2010 15:55 |
|
Really dumb question that I can't seem to find an answer for via Google. Why does the anonymous function in the href attribute cause a "syntax error" in Firefox?code:
|
# ? Dec 2, 2010 22:30 |
|
Horse Cock Johnson posted:Really dumb question that I can't seem to find an answer for via Google. Why does the anonymous function in the href attribute cause a "syntax error" in Firefox? After a quick bit of research (I never, ever use javascript in attributes like that), I suspect that the issue is that providing an anonymous function like that shouldn't do anything. Think about it: if you used that code as part of a normal script, it would just create a useless, referenceless anonymous function: code:
You can probably get away with stripping off the anonymous function entirely: code:
|
# ? Dec 3, 2010 00:49 |
|
It doesn't actually "work" in any browser; it's just that trying to navigate to something that can't possibly be interpreted as a URL results in nothing happening, which is what the author presumably wanted anyway. The only difference is that Firefox complains more visibly about the error.
|
# ? Dec 3, 2010 01:10 |
|
Plorkyeran posted:It doesn't actually "work" in any browser; it's just that trying to navigate to something that can't possibly be interpreted as a URL results in nothing happening, which is what the author presumably wanted anyway. The only difference is that Firefox complains more visibly about the error. Well, apparently the href="java script:some expression" syntax does in fact work (source) Again, I have never have used this 'feature,' so what actually happens is just my best guess vv.
|
# ? Dec 3, 2010 01:41 |
|
Yes, that's absolutely valid (if ill-advised); the expression just has to evaluate to a string (or thing that can be converted to a string), which function() { return false; } does not.
|
# ? Dec 3, 2010 01:57 |
|
Has someone made something like a (good) ecma5-shiv.js? Something that extends the base objects with the new ECMA5 functions if they don't exist? It feels silly doing things like if(!Array.prototype.filter) myself, and the best I could find Googling is Mozilla's definition of the new functions and they wrote a JS interpretation of each in a really manner.
|
# ? Dec 11, 2010 04:18 |
|
NotShadowStar posted:Has someone made something like a (good) ecma5-shiv.js? Something that extends the base objects with the new ECMA5 functions if they don't exist? It feels silly doing things like if(!Array.prototype.filter) myself, and the best I could find Googling is Mozilla's definition of the new functions and they wrote a JS interpretation of each in a really manner. A quick poke around google turned up this on github. Caveat emptor, etc.
|
# ? Dec 11, 2010 05:34 |
|
Good try, but they mostly just copy/pasted the Mozilla ones which are . Var declarations all over scopes, bit shift operations, other JS nastiness that you'd think the people at Mozilla would know not to do. I'll probably just use that as a basis on fixing up my own.
|
# ? Dec 11, 2010 09:11 |
|
NotShadowStar posted:Good try, but they mostly just copy/pasted the Mozilla ones which are . Var declarations all over scopes, bit shift operations, The bit-shift operators are most likely being used as a form of type coercion, specifically into a numeric type. I would have just used "foo + 0" myself, but there might be something going on of which I know nothing. Comments would have been nice. They probably copied the MDC code for the reason below (emphasis mine) and simply didn't want to mess with code that worked: Mozilla posted:https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/Filter Above specifically refers to Array.prototype.filter, but the docs for other Array methods on MDC have similar statements.
|
# ? Dec 11, 2010 16:03 |
|
I'm not sure if this is possible, but maybe if it is, someone knows how to do it. I'm writing a widget that geocodes an address and then passes that address via URI to a page with a map on it. The set up worked great when the map page stood by itself. Now, that page has to live in an iframe within a template page. I'd still like to be able to pass the address via URI to the map page, but I can't think of how to bypass the page with the iframe and pass the URI directly to the map page within the iframe. I'd like to avoid making changes to the map page as it will have to go through a reasonably complex cert process if I do.
|
# ? Dec 13, 2010 20:54 |
|
There Will Be Penalty posted:The bit-shift operators are most likely being used as a form of type coercion, specifically into a numeric type. I would have just used "foo + 0" myself, but there might be something going on of which I know nothing. I figured out why Mozilla uses >>> to ensure a number. code:
Still doesn't excuse the use of 'var' all over the function though.
|
# ? Dec 13, 2010 21:37 |
|
Blinkz0rz posted:I'm not sure if this is possible, but maybe if it is, someone knows how to do it. make sure your iframe has a name attribute (and I wanna say you might need an id with the same value, but I'm not sure if that's necessary, it couldn't hurt though), then the window object of the iframe is accessible by name, specifically a property on it's parent frame. <iframe name="iframeName" id="iframeName">...</iframe> So set it's location or whatever you need to do: top.iframeName.location = "http://foo.baz"
|
# ? Dec 14, 2010 01:00 |
|
peepsalot posted:make sure your iframe has a name attribute (and I wanna say you might need an id with the same value, but I'm not sure if that's necessary, it couldn't hurt though), then the window object of the iframe is accessible by name, specifically a property on it's parent frame. Thanks for the advice, but I should make clear that the widget lives in a completely different page. Anyway, after posting my earlier question I realized that there's no way to do what I want because js just doesn't work that way.
|
# ? Dec 14, 2010 02:28 |
|
I'm trying to use JavaScript to scrape a page (specifically, the unread list of articles for a logged-in user on instapaper.com), and I'm having an issue parsing the downloaded page. I used XMLHttpRequest to get it as a string. I've checked by outputting to the JavaScript console, and it does download the whole document. However, when I convert the string into XML, it stops parsing partway through the document. The source for the page is here, and it stops parsing at line 58 (i.e. the last line parsed is 57). Is there a reason that would make it stop I'm missing? edit: nevermind, just had to replace the &'s with "[ampersand]amp;"s (the forum automatically does that so I can't say it as usual but yeah ) abraham linksys fucked around with this message at 06:34 on Dec 19, 2010 |
# ? Dec 19, 2010 06:10 |
|
Anal Volcano posted:I'm trying to use JavaScript to scrape a page (specifically, the unread list of articles for a logged-in user on instapaper.com), You'll probably have a better time of it if you use the RSS feed instead of scraping the page.
|
# ? Dec 20, 2010 00:29 |
|
So I'm making my first ever webpage (yay!) and I've gotten to the point where I want to start adding some animations and stuff, the webdesign megathread recommended scriptaculous so I went with that. So what I'm doing is when a user clicks on a link in the navigation bar, the 'CenterDoc' fades out and then fades back in with the relevant information. The solution that I have works, but not if you pound on one of the links, that breaks it. So what can I do to stop that? is there some sort of error checking or something I can do? I'm feeling like using setTimeout() is the wrong thing to do, but I'm at a loss. code:
|
# ? Jan 5, 2011 02:09 |
|
Scenario: I've been making a WYSIWYG web page editor/CMS for a rather narrow vertical. No, Drupal doesn't do what we want it to. Essentially the user can build up a page made of 'widgets', each of which can be one of a small number of types (plain HTML, RSS feed, Embedded object a la Youtube, a few others) and they can drag them around and make tabs and poo poo. The objective is to never let them use HTML, because if we do it's going to be flashing centered bold <FONT FACE> crap because they learned HTML from someone who learned HTML in 1998. Anyhow. New bug report: user cannot make a Delicious tag cloud using the "Embed" widget. Turns out that the Delicious tag cloud does stuff like code:
|
# ? Jan 5, 2011 03:43 |
|
Tres Burritos posted:So I'm making my first ever webpage (yay!) and I've gotten to the point where I want to start adding some animations and stuff, the webdesign megathread recommended scriptaculous so I went with that. I'd do something like this, to "lock" the function and make it non-reentrant while it has pending async callbacks in setTimeout: code:
Nigglypuff fucked around with this message at 03:51 on Jan 5, 2011 |
# ? Jan 5, 2011 03:46 |
|
Tres Burritos posted:So I'm making my first ever webpage (yay!) and I've gotten to the point where I want to start adding some animations and stuff, the webdesign megathread recommended scriptaculous so I went with that. That OP is outdated. Everyone uses jQuery now. You should too. The solution to your problem is to remove the event handler from the link when it's clicked on, then add it back when your animation is done, as Nigglypuff alluded to. Also, your code is sloppy.. missing semi-colons, brace issues, etc. In most languages, it's not a big deal, but in JS it can cause crazy errors.
|
# ? Jan 5, 2011 04:17 |
|
Lumpy posted:That OP is outdated. Everyone uses jQuery now. You should too. The solution to your problem is to remove the event handler from the link when it's clicked on, then add it back when your animation is done, as Nigglypuff alluded to.
|
# ? Jan 5, 2011 04:37 |
|
Tres Burritos posted:Thanks for the jquery heads up. I was dawdling along with this javascript stuff, doing some code, seeing if it worked and I noticed the missing semi colons as well. My original "WTF?" was replaced by an almost immediate, "meh" I didn't realize that it would even work without the semicolons, but there you go. So I left it. Javascript will add semi-colons for you. And that's a Bad Thing. Example: code:
|
# ? Jan 5, 2011 04:51 |
|
Lumpy posted:Javascript will add semi-colons for you. And that's a Bad Thing. On the other hand, I'm not sure why anyone would define their object in the actual return value instead of prior to it.
|
# ? Jan 5, 2011 05:07 |
|
geeves posted:On the other hand, I'm not sure why anyone would define their object in the actual return value instead of prior to it.
|
# ? Jan 5, 2011 05:25 |
|
geeves posted:On the other hand, I'm not sure why anyone would define their object in the actual return value instead of prior to it. I do it constantly, and it's one of the "big three" patterns in JavaScript, the Module Pattern. code:
|
# ? Jan 5, 2011 05:35 |
|
Lumpy posted:I do it constantly, and it's one of the "big three" patterns in JavaScript, the Module Pattern. I admit I don't like the way it looks. Perhaps because I would never do that in Java. Especially if the returned object was more complex than just 3 lines. Is it interpreted differently than code:
|
# ? Jan 5, 2011 06:15 |
|
|
# ? May 17, 2024 18:01 |
|
geeves posted:I admit I don't like the way it looks. Perhaps because I would never do that in Java.
|
# ? Jan 5, 2011 06:48 |