javascript

How to skip to next iteration in jQuery.each() util?

I'm trying to iterate through an array of elements. jQuery's documentation says: jquery.Each() documentation Returning non-false is the same as a continue statement in a for loop, it will skip immediately to the next iteration. I've tried calling 'return non-false;' and 'non-false;' (sans return) neither of which skip to the next ...

strptime in Javascript

I have a date input field that allows the user to enter in a date and I need to validate this input (I already have server side validation), but the trick is that the format is locale dependent. I already have a system for translating the strptime format string to the the user's preference and I would like to use this same format for val...

Javascript help rollover is a rollover

I already started this in javascript so I don't want to use jquery but can somejavascript expert look at my code and tell me what I'm doing wrong and or right? Let me tell you what I am trying to accomplish here. I have a menu that consists of four buttons and when you hover over them, they change color and then underneath a heading imag...

VB 2008 Express Replace string inside of Javascript on page loaded into axWebBrowser

I am using VB 2008 express and would like to know If i can Replace a string inside of Javascript on page loaded into axWebBrowser so i can then execScript that function. The specific string i wish to replace is "_new" to "_self" this is so when i call the function it will load in the same page instead of poping into a new web browser. ...

With javascript, can I change the Z index/layer of an svg "g" element?

Let's say I have a couple composite shapes ("g"). I want to be able to click and drag them, but I want the one I happen to be dragging at the moment to be on TOP of the other one in the Z order, so that if I drag it over the OTHER one, the other one should be eclipsed. ...

Javascript 'this' Problem

Why are 'me' and 'this' undefined when setTimeout calls it's anonymous callback? var gMyObj = new MyObj(); gMyObj.myFunc(); function MyObj() { this.myFunc = function () { var me = this; alert(me.constructor); // defined setTimeout(function(me) { alert...

ASP.NET MVC server-side processing of Google search results

Hi, This is probably a really simple question but... I would like to do a Google image search (performed by Javascript as there is no other supported option right?) and resize the images on the server-side. My first thought was to have the Javascript generate links like this: http://example.com/Resize.mvc/(link) However, there ...

Is it possible to auto-fill a file input field on a home server?

With JavaScript, it is quite easy to have an <input> element automatically take on a value once the page has loaded, so long as its type attribute is not "file"; this makes perfect sense, of course, given that auto-submitting a form containing sensitive data to a server is a single line of code away. However, on a home server (WAMP, if ...

The jQuery Validation `valid()` method returns 0 when required is not true

I'm using the jQuery Validation plugin and I've got a textbox with the class digits to force it to be digits only, but not required. When I call validate on the form it works fine, but if I call valid() on the textbox when it's empty, it returns 0, despite no error message showing and required not being set. Does anyone know why it wou...

is there some dojo.fx.sleep function to use within a dojo.fx.chain animation?

I would like to fadeIn a node over one second. Then leave it on for 10 seconds. Then fadeOut for another 3 seconds. One way of chaining this would be as follows: dojo.fx.chain([ dojo.fadeIn({node:myNode, duration:1000}), // fading in for 1 second dojo.fadeIn({node:myNode, duration:10000}), // this does nothing for 10 seconds ...

HTML Object over a SWF

Hi, I have a SWF Video player on my webpage. I want to draw a div tag over it with a high z-index to act as a popup on it . Its a very generic popup. Hence I cannot make it as a part of swf. but, SWF seems to have very high zIndex and would not allow any HTMLO entity to sit over it. How do I achieve this or is there an alternate soluti...

Javascript function() literal overloading

I was always curious is there any possibility to overload function literal, something like you can do with Function: var test=Function; Function=function(arg) { alert('test'); return test(arg); } var b=Function("alert('a')"); var c=Function("alert('x')"); b(); c(); Of course you can guess that this is nice way of debuggin...

Getting a better understanding of callback functions in JavaScript

I understand passing in a function to another function as a callback and having it execute, but I'm not understanding the best implementation to do that. I'm looking for a very basic example, like this: var myCallBackExample = { myFirstFunction : function( param1, param2, callback ) { // Do something with param1 and param2. ...

Javascript private member on prototype...

Well I tried to figure out is this possible in any way. Here is code: a=function(text) { var b=text; if (!arguments.callee.prototype.get) arguments.callee.prototype.get=function() { return b; } else alert('already created!'); } var c=new a("test"); // creates prototype instance of getter var d=ne...

Easiest way to derive subset array of highest 10 values?

In javascript I have an array as follows: var foo = [2, 2, 4, 4, 128, 2, 2, 1, 4, 18, 27, 16, 2, 1, 18, 21, 5, 1, 128, 1, 2, 2, 1, 18, 12, 60, 2, 28, 1, 17, 2, 3, 4, 2, 2, 2, 1, 27, 2, 17, 7, 2, 2, 2, 5, 1, 2, 4, 7, 1, 2, 1, 1, 1, 2, 1, 5, 7, 2, 7, 6, 1, 7, 1, 5, 8, 4]; And I am interested in finding a way (within one loop, not multi...

EXTJS Combobox not selecting by valueField after expand

I have written some code that works pretty well, but I have a strange bug Here is an example... PLEASE WATCH MY COMBOBOX BUG VIDEO Like I said, this works well every time datachanged fires - the right index is selected and the displayField is displayed but, everytime after I type some text in the combobox, later, when the "datachan...

Javascript bridge to Flash to store SO "cookies" within flash

After reading this on the question How do I uniquely identify computers visiting my web site? : A possibility is using flash cookies: Ubiquitous availability (95 percent of visitors will probably have flash) You can store more data per cookie (up to 100 KB) Shared across browsers, so more likely to uniquely identify a machin...

How to determine which html page element has focus?

Is there a way in javascript to determine which html page element has focus? ...

Replace HTML page with contents retrieved via AJAX

I have an HTML page with a typical structure: <html> <head> <script .../> <style .../> </head> <body> content </body> <script> var success_callback = function(data) { // REPLACE PAGE CONTENT & STRUCTURE WITH "data" } ajax(url, params, success_callback); </script> </html> Do you think it is possible ? I've alre...

Is it possible to gracefully handle a Google Maps AJAX request timeout?

My site uses the Google Maps API. In situations where the connection to Google is slow and the map can't be rendered in a reasonable time, I'd like a Javascript callback method to be called such that I can display a useful message to the user rather than have a 'loading...' message constantly displayed. Is this achievable? ...