javascript

Javascript Overriding problem??

Hi, I struck up in a Javascript method overriding problem for a while. the problem is i got onclick event handler on one of my controls and i need to to do inject some method before the event handler triggers the actual method. assume DGrid.Headerclik is actuall assigned to onclick event. And this is what i did DGrid.Headercli...

Monitoring a long task in Javascript

Hello, I have a particular page that uses lots of widgets that have to be initialized by Javascript routines (around 400, it's a complex one). This takes some time (even 20 secs on slower machines). Now I was thinking I could show a progress indicator (a simple text field with a percentage label), instead of the page, but I discovered t...

Is the callback on jQuery's getScript() unreliable or am I doing something wrong?

Hello, I'm using the following bit of script to load another one: $.getScript("CAGScript.js", function () { try { CAGinit(); } catch(err) { console.log(err); } }); The idea is that $.getScript loads the script, then executes the callback when it's done. CAGInit() is a function that lives in CAGScript.js. ...

Is it possible to put Google Analytics code in an external JS file?

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); try { var pageTracker = _gat._getTracker("UA-XXXXXXX-1"); pageTracker._trackPageview(); } catch(err) {} Woul...

asp:LinkButton with Javascript errors in an user control

Hi all, I have a asp.net page with some user controls in it. One of the controls is a search form that has its results populated into a gridview. The gridview needs to have some extra columns that contain 3 LinkButtons that perform a url calculation and redirect to another page. The reason that I chose LinkButton over HyperLink is tha...

Where can I find a time range widget in Javascript/jQuery?

Hi, I'm looking for some sort of TimeRange widget in Javascript/CSS/jQuery. I'm not looking for a time/date picker, which are widely available. I need it for a website to allow businesses to select their openinghours by clicking and hovering over the hours they're open. +-----------------------------+ | 0h 0h15m 0h30m ... 23:45 | ...

Javascript ManualReset event

ok i have a javascript api nothing fancy that has a function "x" that takes some parameters and a callback function. Is there a way i can wait for the callback in the function that calls it almost the same way manualresetevent works in C#. thanks ...

php and js // csv to tables (with extras) to csv

I'm trying to find something already made (hopefully) or some tips on where to start, but what I need to accomplish is take an existing csv file, load it into a html table, be able to edit it, or add duplicate rows, then save my edited version as a new csv file. ...

Add CSS3 support to IE7+ with Javascript

I would like to use CSS3 selectors (such as :nth-child), but they aren't supported by any version of IE. In my Rails app I've already included Script.aculo.us and Prototype and it would be great not to have to include Jquery. Is there any script to fix IE's behaviour? (I'm not interested in IE6 compatibility) ...

Google Protocol Buffers or something similar for .net/javascript

We are currently using Ajax calls to a .net web service that then returns a Json object to the client. Some of these Json objects are pretty massive (> 500k uncompressed). We have heard some good things about Google Protocol Buffers and have been experimenting. So far, we have had pretty good luck serializing on the server with what s...

Javascript / Jquery: $.param( ) inverse function

Given the following form: <form> <input name="foo" value="bar"> <input name="hello" value="hello world"> </form> I can use the $.param( .. ) to serialize the form $.param( $('form input') ) => foo=bar&hello=hello+world How can I deserialize the above String with javascript and get a Hash back? e.g. $.magicFunction("foo=bar&...

Can you control the order in which images (hidden vs visible) on a web page are loaded?

If I have two divs, one shown, the other hidden, I want the images in the visible div to load first and only then for the other hidden images to load. Is there a way to do this? <div class="shown"> <img src="a.jpg" class="loadfirst"> <img src="b.jpg" class="loadfirst"> <img src="c.jpg" class="loadfirst"> <img src="d.jpg" class="loadfi...

How can a click of a button change the content of a drop down menu?

I would like to make it that when a button is clicked a certain values in a drop down menu appears later on in the same document. For example if there was a button called Honda and it is clicked it would change the content in a drop down menu to the model details of the car. How is it possible to do this? CONTEXT: Webpage on a PHP ena...

value of this in the prototype inheritance

If I have: var Shape = function() { this.toString_ = function() { alert(this.UL)} } Shape.prototype.UL = "<UL></UL>" var _2D = function() { this.name = "_2D"} _2D.prototype = new Shape() var i = new _2D() i.toString_() when I call i.toString_() the JS engine try to find if i has toString_ function and not finding it goes int...

Scrolling a webpage inside UIWebView

Hi all, I have a UIWebView and UIButton added as subview to my View. And I have a large webpage displayed inside my UIWebView, is it possible to scroll the webpage by clicking a button on the UIView? I want to make the webpage scroll untill it reaches the bottom of the document. The javascript to be used is : window.scrollTo(xPos, yPo...

Converting PHP Regex's to Javascript (or what are the differences?)

I have a form generator that uses (perl compatible) regexes for ther backend validation. Since the whole form is being dynamically generated it was fairly trivial to add a bit of jquery and then use the same regexes to validate on the client side pre submission. However, some of the time the regexes don't behave themselves in Javascrip...

JavaScript Lint inc_dec_within_stmt warning

Can someone explain the reason/importance of why javascriptlint (not jslint) gives the warning inc_dec_within_stmt - increment (++) and decrement (--) operators used as part of greater statement when it comes across a line of code like someValue = count++; Why should I keep this check turned on? ...

Page designs to prevent redundant+identical e-commerce orders

Hi, noob question: I'm building a checkout system for an online commerce site. I'm getting the bug where clicking on the "place order" button multiple times will place the order multiple times. I have an idea to load between the button-click page and place-order page with a page that waits several seconds before launching using javascrip...

template_bundle_id for facebook js

can anyone please explain to me what template_bundle_id for in facebook js.. Example below template_bundle_id is hardcoded FB.Connect.showFeedDialog(53126803199, null, target, null, null, FB.RequireConnect.promptConnect); 1.what is the use of template_bundle_id if i can hardcode the template_bundle_id ? 2. is unique template_bundle...

getting the location header of an ajax call with javascript prototype

Hi everybody, In my javascript application(using prototype), I need some info from a third party server an this server sometimes requires web interaction with the user, and for that reason it sends 302 http code with a new URL in the Location header. What I want is to capture this new URL to open it in a separate window, however the met...