javascript

Displaying date/time in user's timezone - on client side

I have a web application that displays datetime stamps on every page, for example: December 12, 2009 6:00 pm I would like to dynamically detect the user's timezone and alter the display using JavaScript. So the New York user would see: December 12, 2009 6:00 pm While the California user would see: December 12, 2009 3:00 ...

Disable Adobe Air authentication dialog

I'm building an Adobe Air app that interacts with a third party service using HTTP Basic auth for it's authentication. I'd like to handle the login process completely in my own code. I'm using jQuery to handle the ajax. The issue is that when the user enters bad credentials Air pops up an authentication dialog box before my javascript e...

How to detect struckthrough text using JavaScript

I have a form which presents the user a list of checkboxes, some of which have the text label struckthrough some don't depending on initial conditions. This is functioning fine. During the form validation however, I would like to be able to detect which are struckthrough. I can figure out how to check if they're enabled, but whether t...

if uses haven't accept payment, unset session after 5-10 min. PHP

Hey I', working with a small webshop, (includes a simpel online store - no users requires). I need to find out if an session user haven't "accepted" the payment after.. 5-10 min. If not, I have to "roll-back" the store and set the current shop sessions to null. Any helps how to do it? Or examples would be great.. thx for now ...

input on focus or tab key pressed, move to center of screen

I have a number of form fields spanning over the page fold. When pressing the "tab" key to step through each input/select field it sits the next field on the bottom of the page fold. A few of my fields have tool tips, validation responses and auto suggest boxes that appear below the field. When tabbing to the field, you can't see these ...

How to invoke $(document).ready(function() {}) in unit testing

Hi all: I'm experiencing difficulties trying to invoke document.ready( function() {}) in my unit tests. Suppose I have multiple of them in my javascript file, and one of them called inside a named function i.e. function myFunction() { $(document).ready(function() { //... }); } How do I actually invoke them in my uni...

send php variables to php file using jquery ajax?

i want to send a php variable $thread_id to php file using jquery ajax, so the php file can get all posts for $thread_id and echo it back to main file. it doesnt work when i type: $.get("ajaxcall_reply.php", thread_id: $thread_id, function(data) { $("#threads").html(data); }); how should i type? ...

Ajax autocomplete (or autosuggest) with TAB completion/autofill similar to shell command line completion?

I'm implementing a AJAX autocomplete/autosuggest feature, and not only do I want to do the usual show suggestions that are similar to what the user typed, but I'd like to let the user do partial completions to save typing. So, imagine my dictionary has these values in it: "green apple", "green pear", "green fruit", "blue sky", "blue wa...

Javascript: Light up where mouse is; rest is dark

I think it has been a while but I think I remember seeing a javascript feature where the whole screen is black and where you mouse is it shows what is under the black. Anyone have an idea of how to do this or what I am talking about? ...

XHR persistent connection, how so?

I was just reading how FaceBook designed their chat system, and it reads: "and having that iframe's JavaScript make an HTTP GET request over a persistent connection that doesn't return until the server has data for the client. The request gets reestablished if it's interrupted or times out. This isn't by any means a new technique: it's a...

Pushing data into array with JavaScript.

Hi, I'm relatively new to JavaScript and I've been having trouble pushing data into an array. I have two dynamic vars and I need the array to be formatted like: var array = [[-373597200000, 315.71], [-370918800000, 317.45], [-368326800000, 317.50]]; I already have a loop running for each iteration of the vars, I'm just not sure how I...

What is a reasonable size of JavaScript?

What is the maximum size of JavaScript that would be reasonable for a web page? I have a JavaScript program with a data segment of size about 130,000 bytes. There is virtually no whitespace, comments, or variables in this file which could be minified. The file looks something like this: "a":[0], "b":[0,5], "c":[3,4,24], "d":[0,1,3], g...

Retrieve a cross domain RSS(xml) through Javascript

I have seen server side proxy workarounds for retrieving rss (xmls) from cross-domains. In fact this very question addressess my same problem but gives out a different solution. I have a constraint of do not use a proxy to retrieve rss feeds. And hence the Google AJAX Feed API solution also goes out of picture. Is there a client-only wo...

sIRF, could use some help

It works perfectly when pulled within labels like in the demo <label class="title">I'm no image. I'm Avenir! </label> However, how can I achieve this within the code below (nothing loads)? <div id="zoomcontent"> <span style="margin: 0 10px 0 0" id="slidesbigtext" ></span> <a class="icon2" style="margin: -10px 30px 0 0; font-size:...

Calling a function in the parent page from an element ajax - loaded into a div

Hi y'all... I think this is a common problem... yet i have not been able to find an answer for this... I load some text boxes into a div within a page using ajax when a link is clicked... and during the onFocus event of this newly added elements of the page, i have to call a javascript function that is in the parent page... My probl...

Javascript image editor library

Hi all, My friend and I have plan to build a web shop. One of the shop's main feature is the ability for the customer to design their own stuff. My friend took polyvore website as an example. The above link point to an editor page. In polyvore, the customer can drag and drop items from right-hand side to a 'canvas' in the left-hand sid...

Toggle visisbility of div with javascript

I think the problem was i was writing .innerHtml and overwriting the form elements, is that correct, sorry to waste your time Hi, I am trying to toggle the visibility of a div containing some form elements. The idea is that if the person selects a particular value of a select box an onchange event handler will make a particular div conta...

Is there any difference in following javascript snippets?

Is there any difference in both of these snippets: Writing this snippet at the end of HTML // where should we write the script anyways, is it inside body tag or just after body tag. <script type="text/javascript"> insertNavigation(); // any arbitrary method </script> Or writing this snippet at the end of HTML <script type="text/j...

Automatically scroll when mouse is idle

I need to find a way to randomly scroll horizontally and vertically, plus or minus a set number of pixels per second in each dimension, when the mouse has been idle for a set amount of time. Any ideas on how to achieve this? Thanks in advance, Robert ...

Javascript Add Date Problem

Hi, I've this snippet: var d1 = parseInt( document.getElementById('day1').value ); var m1 = parseInt( document.getElementById('month1').value ); var y1 = parseInt( document.getElementById('year1').value ); var dt = new Date(); dt.setYear(y1); dt.setMonth(m1); dt.setDate(d1 + 1); document.getElementById('day2').value = dt.getDate(); d...