javascript

Why is my custom module not available after YUILoader.onSuccess event fires?

Hi all, Trying to write better JavaScript, woohoo! First step for me: YUILoader dependency loader so all of my custom code is available to use at a reliable point in time. My current environment: YUI (2.8.1) library path: C:\wamp\www\lib\js\yui\2\build\ (http://localhost/lib/js/yui/2/build/) All YUI min, debug and raw files located ...

Disable link using javascript

I have following HTML and would like to disable the link using javascript. <a style="white-space: nowrap;" onclick="return InstallWebApp(true);" id="uc_ii_lnkInstall" href="javascript:__doPostBack('uc_ii$lnkInstall','')"> <img style="border-width: 0pt; margin-right: 3px;" id="uc_ii_lnkInstallImg" alt="Install" title="Install" src="/Cort...

Refer back to old iterator value in click() function for javascript/jQuery (closure question)

I'm trying to get the "click()" function to display the value of 'i' at the time I passed in the function. But its referring back to the value of 'i' after it finished. I'm drawing a blank on how to get the function to refer to the value of 'i' when I first passed the function in. for( var i=0; i<10; i++){ var ts = $('#<span></span>'...

What book about JavaScript is today's equivalent of "Programming Windows", "Effective C++", "Design Patterns", or "Inside Windows NT"?

Those of us of a certain vintage remember classic books that combined theory and practical advice. They helped us get from acquaintance to fluency. They gave us a sufficiently solid foundation that we could go on to achieve mastery after enough hands-on practice. For me these books included Charles Petzold's "Programming Windows", Scott...

Are there any libraries to determine if somebody is inside your area (Geolocation range) of business (kind of like a store locator)?

Hi, I have a need to provide a widget on a webpage that allows a user to enter in a zipcode or suburb to determine if the website's business delivers to their area (basically are they inside of some range/radius). Anyone know of any libraries (commercial or opensource that would help achieve this instead of writing my own bit of code. ...

If I release a commercial client-side JavaScript library, how can I detect people using it without paying my license fee?

If I release a commercial client-side JavaScript library similar to the jQuery, how can I detect people using it without paying my license fee? If I insist that the license fee must be paid before the library can be used in a web application, how can I enforce this and determine who is violating this policy? Is this even possible? ...

Product/system to make tutorials for how to use your website

If I'm not mistaken, I once stumbled across a product or something that let you make tutorials for your website using Javascript. Like, you could show the user directly how to do certain things with a virtual cursor, in-browser. Am I making this up, or is this a real thing? Sorry if this question doesn't belong here (StackOverflow claim...

The Bad Parts of Crockford's book: "JavaScript: The Good Parts"?

Definitely, Crockford's book: "JavaScript: The Good Parts" is one of the best books in Javascript. However, it is hard to read. I have spent hundreds hours but still cannot understand it completely. Maybe it is not because of Crockford but Javascript itself. I don't care the Good Parts of the book now, but I want to know the Bad Parts o...

Calling a function in javascript without parentheses

Is there a way in javascript to call a function with out parentheses? For example in jQuery: $('#wrap').text("asdf"); will work and so will $.ajax(ajaxOptions); Thanks Update - More Info I'm mapping a function (class) to window.$ that has a set of functions I want to be able to call with or without parentheses. like jQuery. Update 2...

garbage collection question for javascript

I have two piece of code sample 1 (function(){ var x = 1; this.getx = function() { return x; }; })(); sample 2 (function(){ var x = 1; this.getx = function() { }; })(); both code samples create a closure, x in sample one is referenced, while x in sample two is not referenced, I know x in sample one will not be garbage c...

Adding jqGrid Custom Navigation to Top Toolbar

Is it possible to add navigation items to the "top pager" in a jqGrid? And if so, what's the syntax for doing so? I have an HTML snippet on my page that looks like this <table id="mygrid"> </table> <div id="mygrid_pager"></div> And then an jqGrid initialization that looks something like this $('#mygrid').jqGrid({ ..., //full co...

How can I create a Family tree

I want to create a family tree in my website. Can anyone help me? ...

Make Panel visible using javascript...

I have a Panel with property, Visible set to False <asp:Panel ID="pnlUpload" runat="server" Visible="False" /> and i try to make it visible using javascript as code below document.getElementById('<%= Panel1.ClientID %>').style.visibility = 'visible'; but it's not working, any idea guys? ...

Load order with javascript_include_tag :all

So I've recently started to include quite a few .js files in to my web application and some of them depend on each other so load order is important. However rails caching just seems to load a all.js file with no particular order to the files. What's a good way to solve this issue? ...

How should I replace my naughty JSLint-shy function defs within loops?

I'm getting a few "Don't make functions within a loop." errors from JSLint, anyone got any tidy suggestions on how to fix this stuff up? Perhaps my naughtiness is excusable because of my YAHOO dependencies (yd. below)? I can safely say that the only time I've done the following: for( var i=0; i<FLN.revealers.length;i++ ) { var revE...

A Good jQuery drop shadow plugin?

In my spare time am trying to learn javascript & jQuery. I generally experiment on a website. I want to achieve a faint shadow-effect when some element appears on the page. This gives - This appears as if the element is above other elements on the page. and makes this new element something important to look at. How can I get this us...

SVG in IE6/7/8, how to make the SVG element capture mouse event before the other HTML elements

I embed a SVG(with adobe svg viewer) in html and browse in IE, and I add mouse listener on the svg element, but I always catch the event after other HTML elements, how to make the SVG element capture mouse event at first in IE, so that I can decide whether to cancel the event <html> <head> <meta http-equiv="Content-Type" content...

How to Run a jQuery or JavaScript Before Page Start to Load

I have a script that I want to run before the page start to load. The script checks the value of a variable and depending on the value redirect the user to a new page. I can successfully check the variable and redirect if needed but the page still loads and display empty page but then quickly redirects to the other page. I don't want t...

Does this method work for solving the quadratic equation using JavaScript?

I'm trying to do some "complex" math where I need to call upon some of JavaScript's Math properties to solve the quadratic equation. Does the following method work? root = Math.pow(inputb,2) - 4 * inputa * inputc; root1 = (-inputb + Math.sqrt(root))/2*inputa; root2 = (-inputb - Math.sqrt(root))/2*inputa; Does this look co...

Getting absolute position of an element relative to browser

I have a div set to the css class float with float being: .float { display:block; position:fixed; top: 20px; left: 0px; z-index: 1999999999; } * html .float {position:absolute;} This class causes the element to stay in a fixed position on the page (the *html part is to make it work in IE). I am using javascript to shift the position...