javascript

Javascript - Waiting for event before proceeding

I'm trying to create ONE javascript function that can do the following: onclick, a form popup in a floating div (this part is okay) the script then some how wait for data to be entered into the form before returning the value in the form. You can say I'm trying to create my own version of javascript prompt. The problem is how to do ...

How can I retrieve contacts/emails from things like MSN, Twitter, Facebook, GMail , etc...?

Hi, I'm building an application that gives users the option to send out an email notification to their friends. The options I would like to give them for this are to: manually write down which emails they would like to send to choose contacts from a list of ones already in the database for that user choose all contacts from facebook,...

compressing object hierarchies in JavaScript

Is there a generic approach to "compressing" nested objects to a single level: var myObj = { a: "hello", b: { c: "world" } } compress(myObj) == { a: "hello", b_c: "world" } I guess there would be some recursion involved, but I figured I don't need to reinvent the wheel here... !? ...

Do browsers widely support numeric quotes in attributes?

There exist other ways of linking to JS, apart from this (the usual).. <script src="myscript.js" type="text/javascript"></script> ...that utilize other quote types: <script src=&#34;myscript.js&#34; type=&#34;text/javascript&#34;></script> Are these widely supported in modern browsers, and older browsers in use, such as IE6? Basica...

Java frameworks vs. Javascript frameworks

I am a big fan of the Dojo Toolkit but I see here often that there are Java frameworks that do the same thing but they are not as extensive or as user friendly as Dojo in my opinion. What are the main differences? Can I use Dojo for the GUI and Java as the back-end? Is there a list of Java frameworks for web development? ...

YUI Loader requests javascript files multiple times?

I am using YUI 2.7.0 and the YUI Loader in several places in one page, and FireBug shows me that, for instance, yahoo-dom-event.js is being loaded several times (by pretty much all of the loader instances). If my page has two "modules", and each one creates a YUI container, and uses the YUI loader to do so, then FireBug shows me that "c...

1.265 * 10000 = 126499.99999999999 ?????

How come when I multiply 1.265 by 10000 I Get this 126499.99999999999 when using Javascript ...

How do I add a parameter in a callback function using prototype.js ?

Hi, Using prototype.js, I create a custom object which is going to be a parameter on a constructor : var options = Object.extend({month: date[0], year: date[1], day: date[2], oncalchange: update}); // update is defined like that : var update = function(d){ // b...

Preferred way to dynamically add markup content from XMLHttpRequest.

Hello, What's the best way to add dynamic content to a web page after a successfull xml http request. To break down a more concrete example: User fills in data in input field (e.g. a forum post) Data is asynchrously updated using the ajax technology The forum post is instantly displayed for the end user Sites like Facebook or last.f...

Strange behavior of javascript

Hi I'm using following function to goto a proxypage on a click of href. for first click to the href it works fine. but second click onwards the code does not call the window.event.returnValue=true; statement while if i use debugger it works as expected. function CallDownloadProxy(url) { //debugger; try { window.location = u...

Can browsers understand unquoted attributes values?

Further to my last question, I'd like to know if current browsers can read attribute values without any quotes, even if the value contains slashes, like: <script src=/path/to/script.js type=text/javascript></script> Will it work without causing a DOM parsing error and corrupting the entire document? ...

Obtaining in IE the length of a Java array passed from an applet to its Javascript wrapper

I have the following method in my applet: public File[] getFiles() Which I call from Javascript as follows: var files = applet.getFiles(); for (var i = 0; i < files.length; i++) { // Do something. } This works in Firefox but IE gives me 'length' is null or not an object Any ideas anyone? ...

datagrid / textbox works in IE 6/7, but not others

hi guys, I have a form consisting of one textbox and button.On clicking on button one popup appears which contains one datagrid from which i can select value ,such that value appears in textbox(using javascript).In IE6 and IE7 ,i can select value from grid in popup,but in IE8,Mozilla and chrome iam not able to select.What may be ...

Huge Integer JavaScript Library

Is there any JavaScript library that can be used for calculations involving 700+ Digits? Also, how about the same thing in C++? ...

Javascript - textarea select word only

By default, when one double click on a word in a textarea, it will select the word AND the space after the word. Is there a js script that can allow user to double click on a word and select ONLY the word, without the space that follows? I've been searching high and low with no luck. ...

hovering hide in rad menu when flash is below to that menu in firefox ?

hovering hide in rad menu when flash is below to that menu in firefox ? ...

How to get walking or driving distance via google maps with php

I've worked with google maps before, but when implementing it, I've never found any documentation on how to get the exact distance between 2 given locations via Javascript or PHP. 1) It has to be the exact same distance shown on maps, not that formula that gives you the distance in a straight line from one geopoint to the other. 2) It ...

Can I create a 'window' object for javascript running in the Java6 Rhino Script Engine

I want to run some Javascript on my Java6 server - i.e. using the javax.script API, specifically the Rhino Script Engine. (Although another solution would be acceptable) The script file is created & supported by a third party, so I don't want to download it and edit it in case it changes over time. The script directly references the 'w...

Why does JavaScript's eval need parentheses to eval JSON data?

I've learned (the hard way) that I need to add parentheses around JSON data, like this: stuff = eval('(' + data_from_the_wire + ')'); // where data_from_the_wire was, for example {"text": "hello"} (In Firefox 3, at least). What's the reason behind this? I hate writing code without understanding what´s behind the hood. ...

how to remove text between <script> and </script> using python?

how to remove text between <script> and </script> using python? ...