javascript

How to mimic effects of MaxScriptStatements (i.e. prevent "A script on this page is causing Internet Explorer to run slowly") without changing the registry?

We are using Bing and/or Google javascript map controls, sometimes with large numbers of dynamically alterable overlays. I have read http://support.microsoft.com/kb/175500/en-us and know how to set the MaxScriptStatments registry key. Problem is we do not want to programmatically set this or any other registry key on users' computers b...

jQuery: Templating data

I have a unique situation where I'm building a site that will call data via AJAX and load it into "containers" (basically just divs styled and arranged according to elements retrieved from the AJAX callback). I'm not sure how many of these unique container types will be created (styled and rendered) when all is said and done, so I'm lo...

Replace the entire HTML node using jQuery

I have a string which looks like: <html><head><title>example</title></head><body>some example text</body></html> I get this string returned as a result to an AJAX request. I would like the browser to render and display that string. The idea would be to do something like: $('html').parent().html(myString); Well, that doesn't work...

table cell width won't change in IE7 if select element content is changed via JavaScript

I have a table in my web site, with a select element in one of the cells. If I try to change the content of the element, everything works fine in most of the browsers that I've tried (including IE6, surprisingly enough), but in IE7, the table cell does not adjust its width to fit the select element. Is there any way to make the table cel...

JavaScript Error occured with JSONP in bookmarklet

The following Error occured in FireBug Firefox3.5.2 Failed to load source for: http://example.com/ My bookmarklet is javascript:( function(){ window.callback = function(d){alert(d)}; var script = document.createElement('script'); script.setAttribute("type", "text/javascript"); script.setAttribute("...

Option for page range while printing html

If i have 1000 pages of html can i provide option for page range while printing html? Is it possible in javascript? (Ex: print page 100 to 200) ...

How do I attach the "select" event to every text node on the page? Is there a better way?

NOTE: Solved my own problem, it seems. See the edits. I am trying to write a greasemonkey script that will highlight all the matching texts on the page when the user selects a text, and then remove the highlighting when the selection is canceled. I am looking for a jQuery way to do this. It seems like there is a select event in the jQue...

javascript cannot be cached?

Just curious on this, is it possible to cache javascript? That is, to minimize client cpu needed to recalculate some logic each time I refresh the browser? Take the google javascript map for example. When I emebed the map on my page, is there any cache mechanism that I can use on my page? ...

Modifying the HTTP headers client-side with JavaScript

Is it possible to use JavaScript to dynamically change the HTTP Headers received when loading an image from an external source? I'm trying to control the caching of the image (Expires, Max-Age, etc...) client-side since I do not have access to the server. ...

How can I define static properties for Rhino's ScriptableObject?

Rhino provides Scriptable interface and ScriptableObject helper class to implement a javascript object backed by a java object. When ScriptableObject is constructed, its methods with names starting with jsFunction___, jsStaticFunction___, jsGet___, jsSet___, jsConstructor are automatically defined for the javascript object. This way yo...

Appending to the dom inside each iteration or create an array and output?

I posted a question yesterday dealing with parsing json data. In one of the follow up answers someone said I was taking a performance hit by using the jQuery append() function within each iteration, while using each(). I was doing: $.getJSON("http://myurl.com/json?callback=?", function(data) { // loop through each post ...

Variables Access Prototype

Hi All, I am working on the new Palm Pre WebOS, the Apps for Palm Pre are developed in MojoSDK which is developed on top of Prototype Javascript Framework. I am trying to access variables defined at assistant level in event handlers which are a part of the same assistant as well. When I access the assistant level variables in an event ...

Jquery Listbox Change event does not fire on Keyboard scrolling

I've got a simple Listbox on a HTML form and this very basic jQuery code //Toggle visibility of selected item $("#selCategory").change(function() { $(".prashQs").addClass("hide"); var cat = $("#selCategory :selected").attr("id"); cat = cat.substr(1); $("#d" + cat).removeClass("hide"); }); Th...

OpenLayers vs Google Maps ?

Hi, I have used Google Maps a couple of times, but what wondering about OpenLayers... Before starting any kind of coding, here are a couple of questions that come to my mind, and you might help me about : Why would I use OpenLayers instead of Google Maps ? Except for it's OSS licence, anyway Did you encounter any situation in which y...

Using FBJS to change CSS

I'm a bit stumped by the Facebook implementation of Javascript. I want to set up a listener on a checkbox so that when checked, it changes the class of an element I can get by ID. I've been using the test console and have tried various permutations. Javascript is NOT my first language, nor my second, third... COuld anyone help me by tra...

JQuery: Why is hoverIntent not a function here?

I'm modifying some code from a question asked a few months ago, and I keep getting stymied. The bottom line is, I hover over Anchors, which is meant to fade in corresponding divs and also apply a "highlight" class to the Anchor. I can use base JQuery and get "OK" results, but mouse events are making the user experience less than smooth. ...

How does Google Analytics authenticate a website?

Just looking for some general information on how the Google Analytics javascript code placed on the bottom of each page authenicates a website. Obviously there is a tracking code which is paired to the domain name but is there more to it than that? Is it checking anything else to make sure its secure and not open to misuse? ...

Open Flash Chart 2 IE doesn't load new data for chart

I have OFC2 chart in my page and when user selectes choice, then it will make another request to server with parameters and OFC2 should load new data from server, but IE won't load new data, but it shos old data instead. It works well in other browsers, but not in IE. What could be the problem here, and how can I solve it? ...

Javascript RegExp does not work in IE

The parameter *return_value* contains <textarea>{"id":43,"description":"","item_id":28,"callback":"addNewAttachment","filename":"foo.jpg",,"type":"posts","ext":"jpg","size":145}</textarea> The next code removes the textarea tags in Firefox, Chrome, so the content can be accessed in arr[1]. In IE alert("Failure") is called. funct...

FCKeditor and accessing the editor selection

I have added a custom file selector plugin for FCKeditor and inserting of a new link works fine. The problem is that I should be able to detect when the current cursor location or selection is a link already. At the moment this causes nested anchor tags instead of updating the existing link. The FCKEditor JavaScript API is not too helpf...