javascript

Is there a JavaScript library that adds missing standard iteration methods (filter, map, reduce, some...) to Array?

Is there a JavaScript library which just adds some methods of Array, Object and other standard objects which have been standardized, but that are not available in all browsers? I am thinking of iteration methods in Array such as filter(), map(), reduce(), some(), or keys() in Object. Note that I don't want the library to introduce anyth...

How to write a function to determine the population count of a 16-bit integer using php or javascript?

How to write a function to determine the population count of a 16-bit integer using php or javascript. Population count is defined as the number of bits that are "turned on," or in others, it is the number of 1s in a binary representation of a number. For example, the binary number 0b0000 has a population count of 0 because there aren't ...

Ideas-guidance for data visualization tools and plugins

Trying to bring different tools/technologies into one project, so this question is for ideas to achieve each stage. I'm currently using GraphViz and like it's simplicity in presenting data; compared to other comparable tools. Project: Computer network. Is there an alternative (javascript/client side) tool to ZGRViewer? I like its abil...

Instance Eval in Javascript around browsers

From Coffeekup and JAML's source, (while working on question), we can see a way to hack ruby's instance eval into Javascript (JAML author explains more). It involves decompiling the function, and evaluating it around a with block. The question is: is this supported all around browsers/js runtimes? I know it works on firefox, opera and c...

Upload a dynamic page to server

Hello, I have a page that contains a table that the user can update. This has been done using javascript. When the user has finised updating, I want to have the raw HTML page uploaded to the server, and then the user will be redirected to a php page which will do some final processing and spit out a report. Is this possible or should...

JavaScript: Given the DOM, find the largest piece of continuous text (content part)

Hi Folks, The goal is to find the largest piece of contiguous text in a document. The problem is that the largest piece does not lie under a single element, e.g. a blog post which has <p> tags in it so iterating nodes and comparing innerHTMLs is not going to work. And by getting innerText of an element, the root node always contains big...

JavaScript method execution interruption

How can I interrupt execution of a JavaScript method? The method is scheduled using the "setTimeout" function in JavaScript, I need to interrupt that method execution(not by calling the "clearTimeout" function because it cannot interrupt a method execution during its execution but can cancel before it already started to executing, after ...

How to detect if a web page if running from a website or local file system

I'm a newbie to javascript. How can I detect if my javascript is being run from a web site (http://) vs a local file. ...

How can I use $(this) inside of Fancybox's onComplete event?

I'm trying to use jQuery's $(this) inside of Fancybox's onComplete event, but I'm running into trouble. Here's my javascript code: $('a.iframe').fancybox({ centerOnScroll: true, onComplete: function(){ var self = $(this); var title = self.title; alert(title.text()); } }); I have simplified the code abo...

Find the occurence of a character in a string

Hi all, Could someone please tell me how to find the occurence of a character in a string? I have to check the number of lines getting displayed (using the br tag) in a dynamically created div. Thanks in advance, Ashriya ...

ux media plugin for extjs

How can i use this plugin, uxmedia [extjs] in my application. any example http://www.sencha.com/forum/showthread.php?23983-ux.Media-.Flash-Flex-Components-2.1.2&amp;highlight=ux.Media ...

Microsoft jscript runtime erroe Object Required

I am not getting any error in my application but when I run it and click on a button then jscript runtime error object reqired happens with the option of break and continue... How can it be solved?? ...

How to extract titles, images and text from any kind of feed ?

I want to extract the titles, images and text from any kind of Feed Rss ( feedburner, xml, etc ). How can I do this with javascript ? For example, I want to extract the stuff above from this feed: http://feeds.mashable.com/Mashable and from this feed: http://casadipacheco.blogspot.com/feeds/posts/default ...

I'm trying to pick a framework for a product I'm about to build, and so far I'm leaning toward Nagare... Any thoughts?

http://www.nagare.org/ As far as the type of product and framework usage, think something like Facebook (it's not exactly a social network, but close enough for evaluation in this context). Basically, I'm just looking for something robust, scalable, easy to work with (small learning curve is a plus), compatible with older browsers, and...

Why i am unable to bind a method on onClick event of div?

I am trying to create div elements dynamically, and at the time of creation i am using onClick = 'showDimension();'. It shows the correct html on alert box but when DIV is created you can see that div is not having any onClick method attached [ firebug ]. Instead of that it is having a stray string 'showDimension();'. Why it is happening...

Way to get client download speed

Hi, I have to tell to the user in a web application(using struts) the download speed. What is the best way? For the moment I simply have a .jsp filled with java scripts and I calculate the time it takes to the user to load this .jsp(I make this action 3 times and take the average speed). It worked ok when I had slow connection speed(un...

writing JSON object to .json file on server

I'm trying to write my JSON object to a .json file on the server. The way I'm doing this now is: JavaScript: function createJsonFile() { var jsonObject = { "metros" : [], "routes" : [] }; // write cities to JSON Object for ( var index = 0; index < graph.getVerticies().length; index++) { jsonObj...

Pure javascript way to remove class from all items in a list?

I'd like to use Javascript (not jquery) to access all items in a <ul> list and remove the active class from everything except my chosen menu item. Here is the list: <ul id='flash-menu'> <li id="menu1" class='something active'>item 1</li> <li id="menu2" class='somethingelse'>item 2</li> <li id="menu3" class='somethingelse'>item 3</li> ...

using c# variable in javascript

Hi All, I want to know how can i use the C# variable in javascript?? any help will be appreciable thanks in advance ...

Are types and OO coupled ?

Trying to understand if types imply OO and vice versa. Questions: What exactly is a type ? Can a class in ruby be called a 'type'. In javascript, the native functions/objects like Array,String,Function ... Are they types ? Is a C struct a type ? How is it that a language can be typed even when it doesn't support OO ? For e.g. H...