javascript

How does Gmail do comet on Opera?

I would like to know how Gmail (or anyone else) does comet on Opera. Here is what I know so far from my experiments. It doesn't use the event-source tag which is broken in Opera 10.51. It doesn't use iframe which displays a spinning throbber and a busy mouse cursor. It doesn't use responseText on xmlhttprequest when readyState = 3 whi...

IE8 AJAX GET setRequestHeaders not working unless params provided in URL

I'm trying to create an AJAX request in IE8. var xhr = new ActiveXObject( 'Msxml2.XMLHTTP' ); xhr.open( 'GET', '/ajax/' ); // Required header for Django to detect AJAX request xhr.setRequestHeader( 'X-Requested-With', 'XMLHttpRequest' ); xhr.onreadystatechange = function() { if ( this.readyState == 4 ) console.log(this.responseText);...

Drag-and-drop file upload in Google Chrome/Chromium?

Drag-and-drop file uploading can be done in Firefox 3.6. A Google search for html5 drag-and-drop file uploading -gmail gives things like: http://stackoverflow.com/questions/2121018/native-drag-drop-file-upload-in-firefox-3-6 http://www.appelsiini.net/2009/10/html5-drag-and-drop-multiple-file-upload http://www.thecssninja.com/javascrip...

difference between document.ready() inner function and a function in <script></script> tag

What is the difference between these two functions? 1: $(document).ready(function myfunc() { function dosomething() { // do something } }); 2: <script language="javascript"> function dosomething() { // do something } </script> ...

How do I make a div that stays in a fixed position regardless of where you are on the page?

Case example: I have a long list of items, and when I put my mouse over this div changes to that picture of that item. No matter where you scroll to, the div remains in a fixed position. Sort of like a frame. ...

how to pass the strMessage (from codebehind to the script) to get the alert message

how to pass the strMessage (from codebehind to the script) to get the alert message i.e if my strmessage from code behind is hi, then i need You Have Used already the message : hi My code... <script type="text/javascript"> var strFileName; function alertShowMessage() { alert("You Have Used already the message :"+ <%=...

javascript arrays: adding entries

Hi, I'm not sure how I would do this in Javascript. I want to create an array that would contain any number of error messages from my form. I read on websites that you define the key for that array when adding new entries. // Javascript var messages = new Array(); messages[0] = 'Message 1'; How can I add entries into my array using ...

JavaScript readable date/time from PHP's time()

Is it possible to have JavaScript compute a timestamp returned from PHP's time() function and present it in a readable format such as "Sun, 18th April 2010 at 4:00 pm"? ...

Submit form with JS

Im working with a shopping cart plugin and that uses a basic form on the product page to submit values like price, product name, etc.. The problem is that the plugin uses a standard submit button to send the values and I would like to replace said button with a prettier custom jquery rollover. In order to make this happen I used some JS ...

Prevent Users from Performing an Action Twice

We have some problems with users performing a specific action twice, we have a mechanism to ensure that users can't do it but somehow it still happens. Here is how our current mechanism works: Client side: The button will be disabled after 1 click. Server side: We have a key hash in the URL which will be checked against the key stored ...

Javascript methods, classes and events

Hi, how should I document this piece of code: // Is this class? colors = { // Is this method? "red" : function() { // Do something... } // Still method? "black" : { // So what is this? "black-1" : function() { /* Do something */ } } } I am using YUI Doc. These tags are available @module @class @met...

A plug in to watch the javascript functions is runing in that certain time

Like in fiddler you can watch the logs between client and server. Like fiddler; which logs all HTTP(S) traffic between your computer and the Internet. I want to inspect all traffic happening on the client side JavaScript that runs on a page. Best wishes bk ...

How do you know if a JavaScript library you are using will break your code after an upgrade?

So, you are using a bunch of javascript libraries in a website. Your javascript code calls the several APIs, but every once in a while after an upgrade, one of the API changes, and your code breaks, without you knowing it. How do you prevent this from happening? I'm mostly interested in javascript, but any answer regarding dynamically ...

Javascript in address bar, how do I decipher?

Hello stackoverflow! I have a javascript code that appears to be encrypted: javascript:var _0xe788=[&quot;\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C&quot;,&quot;\x61\x70\x70\x34\x39\x34\x39\x37\x35\x32\x38\x37\x38\x5F\x62\x6F\x64\x79&quot;,&quot;\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64&quot;,&quot;\x3C\x61\x20\x69\x64\x3D\x22\...

noob: how to show login error message on the same page after php server processes request.

Hi, I have a login page. User first enters information and submits the form. And I have a php script that will see if the user exists. If( authenticated == true) { // I do a redirect } else { // I want to popup an error message on the same page. } 1) I'm not sure how to show the popup message, I would like t...

Parameterizing max value of a jQuery ui slider

I'm trying to create this slider http://jqueryui.com/demos/slider/#rangemax Is it possible to parametrize the max value? For ex: $("#slider-range-max").slider({ range: "max", min: 1, max: maxValue, value: 2, slide: function(event, ui) { $("#amount").val(ui...

Will Google AppEngine support Javascript?

Does anyone know or have an opinion on whether AppEngine will add javascript as a supported language/framework and in what timeframe? ...

Import JSON data into Google Spreadsheet

I am pulling data down from a webservice and it is formated as JSON. I am writing a google apps script for google spreadsheet that will populate the data form me. my problem is, I can't seem to get it to parse out. doing: var dataset = myJSONtext; Browser.msgbox(dataset.item[0].key); errors out, saying item[0] is not defined. Is th...

How to clear results on googleBar gmap with javascript?

i am using googleBar on my gmap application, after i manipulate the results of the search i want to clear the results of the search, but without using the clear results button. i want to clear the results with from my JavaScript function. how can i do that? ...

js works inside the page but not in code behind

Hi guys, I have this function put in a MasterPage, which shows up an mp3 player: <script type="text/javascript"> $(document).ready(function() { var stageW = 500; var stageH = 216; var cacheBuster = Date.parse(new Date()); var flashvars = {}; var params = {}; params.bgcolor = '#F6F6F...