javascript

Conversion of table to Excel from JavaScript

I need to export my EditorGridPanel grid data to excel without sending any data to server-side, cross browser and cross platform solution that will work in ie6 and ie7. Any pure JavaScript solution is good as well! So far i have found only data URI solution which is great but ie supports it only from 8-th version. Also there is a possib...

Editable DOM in HTML, like Google Docs

I'm a little curious about how the editing of Google Docs works. How did they implement an editor within the DOM? It does not really looks like a form with a textarea, but rather a normal document body with an additional cursor. I guess it is some javascript technique behind. Is there any free library that I can use for achieving this k...

JavaScript - Get Browser Height

Hi, I am looking for a code snippet to get the height of the viewable area within a browser window. I had this code, however it is somewhat bugged as if the the body doesn't exceed the height the of the window then it comes back short. document.body.clientHeight; I have tried a couple of other things but they either return NaN or th...

Regular expression which matches a pattern, or is an empty string

I have the following Regular Expression which matches an email address format: ^[\w\.\-]+@([\w\-]+\.)+[a-zA-Z]+$ This is used for validation with a form using javascript. However, this is an optional field. Therefore how can I change this regex to match an email address format, or an empty string? From my limited regex knowledge, I t...

Problem with switch

I have this code: var str = $("#datepicker").datepicker("getDate"); var datestr = str.toString().split(" "); switch(datestr[1]) { case "Jan": var datestrmon = "Яну"; break; case "Feb": var datestrmon = "Фев"; break; case "Mar": var datestrmon = "Мар"; break;...

How do I move this JavaScript event from an inline event to its own .JS file?

Hello all. Happened across a snip of JS that I've managed to make work for my uses, but as I'm brand new to javascript, I'm unsure whether I've understood how & why it works. As it stands, it's inline (inside an html tag, but I'd like to see it either in its own .js file so it can be used by several thousand links on one of several hu...

Live click and targeting a specific element in jQuery

I have the following code: $("li.item").live('click',function() { $('#menu').animate({ }, 500); }); Now, I would like to move the character to the li.item you clicked on, but I cannot use $(this) as that would get the #menu item. I also cannot use li.item as there are 60 of them on the page. Is it possible to pull the speci...

Click heatmap and mouse coordinates! - Javascript

Hi folks, I'm trying to build a simple heatmap for one of my sites, but it seems a lot trickier that I thought! 1) There are different themes for the site, 1 is aligned to the left, another one is aligned to the centre. 2) Screen sizes change throughout the users. I need to track clicks on the site, but unfortunately event.PageX and ...

IFrame Comet response contains no data

Hi. I'm experimenting with Comet and I'm stuck with implementing it via a hidden IFrame ("forever frame". This is my index.html: <!DOCTYPE HTML> <html> <head> <script type="text/javascript"> cometResponse = function() { var debugOut = document.getElementById('debugOutput'); return function(response) { ...

How can i detect Adobe AIR version through javascript?

I want to detect the adobe AIR version through javascript..how to do that? ...

Two scripts Javascript doesn't work together

Hello I have two scripts in a file active_form.js The first script hides a text entry when a radiobutton is checked and the second does the same thing when a value is selected in a list. When there are alone, the both work but together my function GereControleRadio do nothing. edit : the two scripts are called in the same form. The ...

Is there a setting in FireFox to allow the parent document access to the DOM of an IFRAME on another domain?

Notice how Firebug can access the DOM of cross domain iframes and even allow you to modify them? I'm wondering if there is an firefox addon extension or a config setting that will allow a page on our intranet to do this. Longer explanation: I have a two "kiosks" in our reception area that the public can use. As we're running in kiosk m...

HTML page submission without redirection

Is there any method to submit an html form without redirecting from the current page without using ajax ? ...

how to make a 'div' element drag on iphone .

this is my code,for some reason , i can't use any javascript lib ,like ;jquery: <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml" style="height: 100%;"> <head> <meta http-equiv="Content-Type" content="text/html; chars...

Handling Scroll bars with jQuery event Drag and Drop

I have a room div with some toy divs arranged on it, see Toys are absolutly positioned and are drag-able with in the walls of the room . The room container div has a fixed height and height, so the room has horizontal as well as vertical scrolls. I use jquery event drag plug-in for setting up DnD. I managed to set up the toys drag only...

Prototype vs jQuery: A specific problem regarding binding, events and values

I'm looking at transferring existing functionality (built with PrototypeJS) to jQuery and have been working through a couple of examples. One example I'm a bit stuck on, specifically with regards to binding functions (and values) to an event. This example tries to apply a mouseover event, with an incremented value to a list of links. Th...

Javascript - Problem in accessing global variables

I want to share values across the two javascript functions but below in second function I am unable to get the value from the global variable // Following two are global variables var grid; var masterTable; function GridCreated(sender, args) { grid = sender; // setting values masterTable = sender.get_m...

How can i access javasript functions from ajax loaded content on the same page?

1) on main page i have javascript function function editSuccess(data) { alert("editSuccess called"); } 2) From main page I load some content into div using ajax then i need call javascript function from loaded content but it's don't see editSuccess function ...

Custom alternative content for non flash users

I have this code http://www.jsfiddle.net/Nntc7/ created by a pdf publisher, I need to offer non flash content to users but dont know javascript and I cant get the thing to work using swfobject, How do I edit this to allow for alternative content?? thanks in advance L ...

How to extract a string from a url.

Hi, I have url that looks like this... http://www.example.com/accounts/?token=111978178853984|683b8096732be7fd725d3332-557626087|m9lSbmoYhZ6Yut4OC3smY1fRf1E. from the token 111978178853984|683b8096732be7fd725d3332-557625434|m9lSbmoYhZ6Yut4OC3smY1fRf1E 557625434 is the id number. How can I extract the Id no from token using javascr...