What is a brief introduction to lexical scoping? Answer I understand them through examples. 🙂 First, lexical scope (also called static scope), in C-like syntax: Every inner level can access its outer levels. There is another way, called dynamic scope used by the first implementation of Lisp, again in a C-like syntax: Here fun can either access x in dummy1
How do you get the length of a string?
How do you get the length of a string in jQuery? Answer You don’t need jquery, just use yourstring.length. See reference here and also here. Update: To support unicode strings, length need to be computed as following: or create an auxiliary function
image.onload not firing twice in IE7
It works in IE6, and FireFox; but for some reason not in IE7. Using ASP.NET on the Page_Init I populate a list of chapters that are links to the image in the book as well as a Javascript array which holds the pageIDs. ex. Chapter 1 –> href=”javascript:seePage(4);” Here is the actual code I am using: When I click on
Get the current URL with JavaScript?
All I want is to get the website URL. Not the URL as taken from a link. On the page loading I need to be able to grab the full, current URL of the website and set it as a variable to do with as I please. Answer Use: As noted in the comments, the line below works, but it
how to get next week date in javascript
Does anyone know how can I get next week date based on this week date? example if I have this thursday date (25/6/2009) how can I use javascript to get next thursday date (2/7/2009)? Answer You can also look at DateJS if you like “fluent” APIs.
reading in utf-8 file (javascript XMLHttpRequest) gives bad european characters
can anyone help? I have small procedure to read in an UTF-8 file with javascript using XMLHttpRequest.. this file has european characters like miércoles sábado etc.. Notice the accents.. But when being read in .. the characters are all messed up.. I have checked the file and it is perfect.. it must be the procedure for reading in.. heres an
Want to fire Dropdown SelectedIndexChanged Event in Javascript
I have dropdown on my page, I am changing selected value of dropdown from popup window using Javascript. I have some logic in dropdown SelectedIndexChanged event, so I need to fire the SelectedIndexChanged event when dropdown selection changed from Javascript. Answer This should work, if you are still getting some error, you can try like this: yourcontrolClientSideID is the ID
Catch browser’s “zoom” event in JavaScript
Is it possible to detect, using JavaScript, when the user changes the zoom in a page? I simply want to catch a “zoom” event and respond to it (similar to window.onresize event). Thanks. Answer There’s no way to actively detect if there’s a zoom. I found a good entry here on how you can attempt to implement it. I’ve found
JavaScript getter for all properties
Long story short: I’m in a situation where I’d like a PHP-style getter, but in JavaScript. My JavaScript is running in Firefox only, so Mozilla specific JS is OK by me. The only way I can find to make a JS getter requires specifying its name, but I’d like to define a getter for all possible names. I’m not sure
Passing Javascript variable to
HTML Part: I just want to sent the javascript variable to link (url parameter) No AJAX Answer If you want it to be dynamic, so that the value of the variable at the time of the click is used, do the following: Of course, that’s the quick and dirty solution. You should really have a script that after DOM load