javascript

What do you use to monitor jscript memory usage in Internet Explorer

We're debugging a GWT app. Runs ok in Firefox, in IE6.0 starts working ok but after some time, it gets on its knees and starts to crawl. After doing some tests we're suspecting some memory problems ( too much memory used, memory leaks, etc ) Besides using taskmanager and processxp to watch the memory usage grow :)....¿do you recommend a...

Will HTML be replaced by any new technology?

I see various frameworks being launched that promise Rich Ui and better User experience as they call it. Silverlight, Flash, Yahoo's new framework etc etc. Does this mean that over a period of time these frameworks will replace the existing HTML, JAVASCRIPT CSS based web applications? Wouldn't it be same as opening an application insid...

Horizontal Accordion for multilevel UL

Hi there, I've been looking at the plethora of horizontal accordion scripts on google. for example: http://www.leigeber.com/2008/05/horizontal-javascript-accordion-menu/ http://www.nyokiglitter.com/tutorials/horizontal.html http://designreviver.com/tutorials/jquery-examples-horizontal-accordion/ All the scripts seem to be made for dis...

checking for scrollbars

Is there a way to check for scrollbars? What I need is a way to see if the user has written too much text in an iframe (using punyMCE). If the user has gone beyond the allowed number of lines (which will cause scrollbars to appear), I want to tell the user that the maximum number of lines has been entered. Now there is a second problem....

MVC-like UI updates in Javascript/jQuery: best practices?

I'm coming across a bit of an awkward problem. I have a Web page with quite a few buttons on it that need to be disabled and enabled at various points. Now if this were a Swing (or any otehr desktop UI interface for that matter), it would be quite trivial: I would simply add listeners for the model changes I was interested in and updat...

scoping of private variables in object prototype methods

This question is about the behavior of an object with methods added to its prototype chain and a few private variables. Just out of curiosity and to get my head around this riddle. function SomeObject() { if (this instanceof SomeObject) { var args = arguments[0], proto = SomeObject.prototype, privatevalue ...

Adding controls in runtime problem ASP.Net

I put a link on a page and onclick i wrote some code to add some controls after clicking, DropDownList newDropdownlist = new DropDownList(); panel.Controls.Add(newDropdownlist); CheckBox newChkbox = new CheckBox(); panel.Controls.Add(newChkbox); TextBox txt = new TextBox(); txt.ID = "txtPhoneValue"; panel.Con...

Adding Custom HTTP Headers using Javascript

Hi, I have the following requirement. On my html page, While clicking the link of an Image ("img") or anchor("a") tags , I would like to add my custom headers for the GET request. These links are typically for downloading dynamic content. These headers could be SAML headers or custom application specific headers. Is it possible to add ...

The use of undefined variables in if-statements

This snippet results in a JavaScript runtime error: (foo is not defined) if (foo) { // ... } I have to define foo first, like so: var foo = foo || null // or undefined, 0, etc. ... And only then can I do: if (foo) { // ... } Why is that? Update: This was somewhat of a brainfart on my side of things: 'fcourse you can'...

JS/jQuery: How can I automatically wrap <a href> tags around <img />s with the href being dynamic based on the img src?

Hello. Heads up: I am quite new to Javascript and have so far only written very basic scripts based on jQuery. I am a quick study though.. What I am after is a way to: 1) identify tags 2) read the img tags 3) wrap the tag with an <a href> tag with a dynamic link based on the src of the img. Example: <img src="../../img_T/Cultur...

Why isn't it a must to declare a variable in Javascript before using it?

In Javascript we don't have to declare a variable with 'var' keyword before using it. We can straight away do things like myCount = 12; or myStr = "Hello"; (where myCount, myStr are not declared before). Any such usage, declares and initializes the variables in the 'global' scope. What could be the reasons for providing this feature? A...

Is there a free/open-source JavaScript-to-JavaScript compacting compiler (like Google's)?

If you look at the source of Google pages with JavaScript, you'll find that the JavaScript is clearly not readable -- or maintainable. For example, all variables and functions are one-letter named (at least, the first 26 are...); there are no extraneous white-spaces or linebreaks; there are no comments; and so on. The benefits of this c...

Javascript calling C# function under SliverLight

I have a SilverLight application using C#, with 2 main functions that I want to make accessible from JavaScript functions. I have done the RegisterScriptableObject() in the class and set-up the [ScriptableMember] for the functions I want access to. This the SilverLight object: <div id="silverlightControlHost"> <object id="silverlight...

Recommended lightweight balloon javascript library

Looking for small and light popup balloon JS library. (not part of other lib such as jquery) Must be cross browser. I found several. Any recommended one? ...

ready-to-use xmlRequest snippet returns status code 0 on a call

I'm creating a very basic dashcode widget. I'm using customized snippets from Apple: xmlRequest setup and xmlLoaded. Below is my code function sendURL(){ // Values you provide var textField = document.getElementById("searchqeue"); // replace with ID of text field var textFieldValue = textField.value; var feedURL = "feed...

Preventing ASP.NET MVC from Replacing period with underscore in Html Helper IDs

Having just upgraded to the latest ASP.NET MVC Release Candidate I noticed that, when using Html Helpers, any name with a period "." in it will have this replaced by an underscore "_" when the element's ID is output. I believe this is to aid in using JQuery and the use of the period is to aid in the use of ModelBinders. This has broken ...

How is the memory allocation done for variables in scripting languages?

For example, in javascript I can say var x = 5; Later I can do x = 'a'; and then x = "hello"; So, how is memory allocated for the variables? As it is, all variables have a common type 'var' and values of variables can change at run-time as seen above. Isn't it a difficult task to allocate and manage memory for these variables?...

Free-Form Date Picker - like RTM

I'm looking for a way to have a textbox that allows users to type in a date in any format and turns around and formats that date in a 'mm/dd/yyyy' format. So the user could type in "Today" and it would turn the date as 02/24/2009 or they could type in Wednesday Feb 24 and formatting would automatically pick up. Remember the Milk does t...

Best way to signal my JS script is loaded

I have a JS script that will be hosted on my server and that others will embed in their html, i.e. ...<code for http://yoursite.com /> <script type="text/javascript" src="http://mysite.com/awesome.js" /> ...<code for http://yoursite.com /> My script surfaces an object with a bunch of properties accessible for use as a javascript Objec...

jQuery UI Draggable - need to modify element while dragging

Hi, I'm playing with Drag and drop funcitonality for the first time so I'm not entirely sure what I'm doing! I need to add a class to a "portlet" while it is being dragged. I don't want to use the clone functionality because I want the user to drag the actual element, I just want to nodify the element while it is being dragged and rese...