javascript

How can I force NetBeans to annotate a javascript file?

I'm using NetBeans 6.5 and I have some javascript files that it claims are binary files and won't display annotations. svn propedit shows that the svn:mime-type is text/javascript and to display the annotations on the command line I have to run "svn annotate --force file.js". ...

Browser Java Plugin Detection

What is the preferred method to determine if the Sun Java Plugin is installed in the browser? ...

How can I temporarily prevent a scrollable div from scrolling?

Here is my current situation: I have a web page containing a couple scrollable divs. Each of those divs contains a number of objects. I am using YUI to display popup menus of actions that can be performed on each object. Each object has its own menu associated with it that is constructed and displayed dynamically. The popup menus can be...

How do I index an array of jQuery objects elegantly?

I find myself starting to write this: $($("a-selector-which-returns-multiple-objects")[index]).SomejQueryFunctionForExampleShow() Because I have one query which returns multiple objects, then the [index] operator returns the DOM object, not a jQuery object, so I convert it back to a jQuery object with the outer $(). This is working fi...

Firefox setting to enable cross domain ajax request

I need to temporally allow cross domain XMLHttpRequest. Changing firefox security setting seems to be the way to go. But I've tried with this and this but they didnt work. Has anyone been able to configure this before? Thanks. ...

Detecting idle time in JavaScript elegantly.

Is it possible to detect "idle" time in JavaScript? My primary use case probably would be to pre-fetch or preload content. Idle time: Period of user inactivity or without any CPU usage ...

Why doesn't this work? Calling functions belonging to objects in a loop.

In my code jsc.tools is an object containing objects. Each sub-object contains a init() and run() method. I have the following code running at startup: for(tool in jsc.tools) { tool.init(); } which gives me the error "tool.init is not a function". A sample of a tool's declaration is: jsc.tools.sometool = {}; jsc.tools.sometool.run...

Does .live() binding work for jQuery in IE7?

Hi everyone, I have a piece of javascript which is supposed to latch onto a form which gets introduced via XHR. It looks something like: $(document).ready(function() { $('#myform').live('submit', function() { $(foo).appendTo('#myform'); $(this).ajaxSubmit(function() { alert("HelloWorld"); }); return f...

How to get nodes lying inside a range with javascript?

I'm trying to get all the DOM nodes that are within a range object, what's the best way to do this? var selection = window.getSelection(); //what the user has selected var range = selection.getRangeAt(0); //the first range of the selection var startNode = range.startContainer; var endNode = range.endContainer; var allNodes = /*insert ma...

Jquery queueing animations

I have several animations that I want to perform on different objects in the dom. I want them to occur in order. I do not want to do it like this: $('#first').show(800, function () { $('#second').show(800, function () {...etc...}); I want to add all my animations(and cpu intensive functions) to some kind of queue object that will m...

Detect blocked popup in Chrome

I am aware of javascript techniques to detect whether a popup is blocked in other browsers (as described in the answer to this question). Here's the basic test: var newWin = window.open(url); if(!newWin || newWin.closed || typeof newWin.closed=='undefined') { //POPUP BLOCKED } But this does not work in Chrome. The "POPUP BLOCKE...

How can I start a flash video from javascript?

Is it possible to start playing a file inside a flash player by making use of javascript code? If so, how would I do it? ...

How does Facebook keep the header and footer fixed while loading a different page?

When browsing through Facebook pages the header and fixed footer section remain visible between page loads AND the URL in the address bar changes accordingly. At least, that's the illusion I get. How does Facebook achieve that technically speaking? ...

Is it a good idea to learn JavaScript before learning jQuery?

Is it a good idea to learn JavaScript before learning a JavaScript framework library such as jQuery, Prototype, etc.? Sometimes I find myself struggling because I feel I don't know JavaScript as well as I should. ...

User notification ASP.NET (want the ability to trigger from BOTH server and client)

I saw a couple of similar questions here, but what I'm trying to do is a bit different. I want to have a way to give users some feedback on their actions which can be controlled from both client and server side. I've build a UserControl with a label (label's text property is exposed) and some JS which hides the label shortly after the ...

How do I shift the visible text in a narrow input element to see the cursor at the end?

The problem I am having is that given an input element with a maxlength that is much wider than the element's width (as set in its style), and, given a value that is wider than the element's width, how can I get the element to "scroll" to the end of the text. In IE it is easy, I create a textRange object, put its start and end position ...

Regexp for matching numbers and units in an HTML fragment?

I'm trying to make a regexp that will match numbers, excluding numbers that are part of other words or numbers inside certain html tags. The part for matching numbers works well but I can't figure out how to find the numbers inside the html. Current code: //number regexp part var prefix = '\\b()';//for future use var baseNumber = '((\\...

CSS/JS GZip Compression with Asp.Net

I am currently on a hosted Virtual Server, I want to enable GZip compression for my Asp.Net 3.5 site, how do I go about starting? I have tried using 'packed' JS files, but they don't work, I am assuming it's because they are not handled correctly...? ...

Flex vs. JavaScript

RIA are more richer when it is developed using Flex. Will this be an obstacle for developers using Javascript for front-end? Will javascript be replaced with Flex? ...

how do you set a max-age for javascript/css?

I just ran Pagetest and it says I need to set a max-age for my JS/CSS. How do I do that? ...